Skip to content
Permalink
Browse files
Apply similar fix as needed for AMQNET-298
  • Loading branch information
Timothy A. Bish committed Jan 10, 2011
1 parent 05c5ccd commit 0ece37880abfe78cf79a7f8c683c1aa197955d24
Showing 2 changed files with 11 additions and 2 deletions.
@@ -45,6 +45,7 @@ public class InactivityMonitor : TransportFilter
private AsyncWriteTask asyncWriteTask;

private readonly Mutex monitor = new Mutex();
private bool disposing = false;

private Timer connectionCheckTimer;

@@ -97,8 +98,8 @@ protected override void Dispose(bool disposing)
// get rid of unmanaged stuff
}

this.disposing = true;
StopMonitorThreads();

base.Dispose(disposing);
}

@@ -265,7 +266,7 @@ public override void Oneway(Command command)

protected override void OnException(ITransport sender, Exception command)
{
if(failed.CompareAndSet(false, true))
if(failed.CompareAndSet(false, true) && !this.disposing)
{
Tracer.Debug("Exception received in the Inactivity Monitor: " + command.ToString());
StopMonitorThreads();
@@ -277,6 +278,11 @@ private void StartMonitorThreads()
{
lock(monitor)
{
if(this.IsDisposed || this.disposing)
{
return;
}

if(monitorStarted.Value)
{
return;
@@ -151,6 +151,8 @@ protected virtual void Dispose(bool disposing)
{
if(disposing)
{
Tracer.Debug("TransportFilter disposing of next Transport: " +
this.next.GetType().Name);
this.next.Dispose();
}
disposed = true;
@@ -190,6 +192,7 @@ public ResumedHandler Resumed

public virtual void Stop()
{
this.next.Stop();
}

public Object Narrow(Type type)

0 comments on commit 0ece378

Please sign in to comment.