[
https://issues.apache.org/activemq/browse/AMQNET-50?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jim Gomes closed AMQNET-50.
---------------------------
Resolution: Fixed
> Disposable objects should follow standard disposable implementation pattern
> ---------------------------------------------------------------------------
>
> Key: AMQNET-50
> URL: https://issues.apache.org/activemq/browse/AMQNET-50
> Project: ActiveMQ .Net
> Issue Type: Bug
> Components: ActiveMQ Client
> Environment: Windows XP SP2, .NET 2.0
> Reporter: Jim Gomes
> Assignee: James Strachan
> Priority: Minor
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> Objects that implement the IDispose interface and have unmanaged resources
> should use the dispose pattern that uses an internal method to dispose of the
> objects and then turns off the finalizer call from the garbage collector.
> This allows for safe and efficient disposable of unmanaged resources.
> The following objects implement the IDisposable interface and have
> attachments to unmanaged resources.
> ActiveMQ.Connection
> ActiveMQ.Session
> ActiveMQ.MessageProducer
> ActiveMQ.MessageConsumer
> The basic pattern is as follows:
> class Disposable : public IDispose
> {
> private bool disposed = false;
> ~Disposable()
> {
> Dispose(false);
> }
> public void Dispose()
> {
> Dispose(true);
> GC.SuppressFinalize(this);
> }
> protected void Dispose(bool disposing)
> {
> if(disposed)
> {
> return;
> }
> if(disposing)
> {
> // Dispose managed code here
> }
> // Dispose unmanaged code here
> disposed = true;
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.