Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 86768 invoked from network); 4 Mar 2010 15:56:32 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Mar 2010 15:56:32 -0000 Received: (qmail 74601 invoked by uid 500); 4 Mar 2010 15:56:21 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 74570 invoked by uid 500); 4 Mar 2010 15:56:21 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 74558 invoked by uid 99); 4 Mar 2010 15:56:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Mar 2010 15:56:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Mar 2010 15:56:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 54E1E23888FE; Thu, 4 Mar 2010 15:55:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r919036 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs Date: Thu, 04 Mar 2010 15:55:58 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100304155558.54E1E23888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Thu Mar 4 15:55:58 2010 New Revision: 919036 URL: http://svn.apache.org/viewvc?rev=919036&view=rev Log: Fix for: http://issues.apache.org/activemq/browse/AMQNET-240 Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs?rev=919036&r1=919035&r2=919036&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs Thu Mar 4 15:55:58 2010 @@ -39,10 +39,10 @@ private Atomic inRead = new Atomic(false); private Atomic inWrite = new Atomic(false); - private CompositeTaskRunner asyncTasks; + private CompositeTaskRunner asyncTasks; private AsyncSignalReadErrorkTask asyncErrorTask; private AsyncWriteTask asyncWriteTask; - + private Mutex monitor = new Mutex(); private Timer readCheckTimer; @@ -236,7 +236,7 @@ { // Disable inactivity monitoring while processing a command. //synchronize this method - its not synchronized - //further down the transport stack and gets called by more + //further down the transport stack and gets called by more //than one thread by this class lock(inWrite) { @@ -344,11 +344,11 @@ // Attempt to wait for the Timers to shutdown, but don't wait // forever, if they don't shutdown after two seconds, just quit. this.readCheckTimer.Dispose(shutdownEvent); - shutdownEvent.WaitOne(TimeSpan.FromMilliseconds(2000)); + shutdownEvent.WaitOne(TimeSpan.FromMilliseconds(2000), false); this.writeCheckTimer.Dispose(shutdownEvent); - shutdownEvent.WaitOne(TimeSpan.FromMilliseconds(2000)); + shutdownEvent.WaitOne(TimeSpan.FromMilliseconds(2000), false); - this.asyncTasks.Shutdown(); + this.asyncTasks.Shutdown(); this.asyncTasks = null; this.asyncWriteTask = null; this.asyncErrorTask = null; @@ -363,7 +363,7 @@ private InactivityMonitor parent; private Uri remote; private Atomic pending = new Atomic(false); - + public AsyncSignalReadErrorkTask(InactivityMonitor parent, Uri remote) { this.parent = parent; @@ -375,7 +375,7 @@ get { return this.pending.Value; } set { this.pending.Value = value; } } - + public bool Iterate() { if(this.pending.CompareAndSet(true, false) && this.parent.monitorStarted.Value) @@ -383,28 +383,28 @@ IOException ex = new IOException("Channel was inactive for too long: " + remote); this.parent.OnException(parent, ex); } - + return this.pending.Value; } } - + // Task that fires when the TaskRunner is signaled by the WriteCheck Timer Task. class AsyncWriteTask : CompositeTask { private InactivityMonitor parent; private Atomic pending = new Atomic(false); - + public AsyncWriteTask(InactivityMonitor parent) { this.parent = parent; } - + public bool IsPending { get { return this.pending.Value; } set { this.pending.Value = value; } } - + public bool Iterate() { if(this.pending.CompareAndSet(true, false) && this.parent.monitorStarted.Value) @@ -420,7 +420,7 @@ this.parent.OnException(parent, e); } } - + return this.pending.Value; } }