Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 191CD9EE5 for ; Fri, 13 Apr 2012 18:14:12 +0000 (UTC) Received: (qmail 27574 invoked by uid 500); 13 Apr 2012 18:14:12 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 27502 invoked by uid 500); 13 Apr 2012 18:14:12 -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 27488 invoked by uid 99); 13 Apr 2012 18:14:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 18:14:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Fri, 13 Apr 2012 18:14:08 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F1A1B238896F for ; Fri, 13 Apr 2012 18:13:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1325891 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs Date: Fri, 13 Apr 2012 18:13:46 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120413181346.F1A1B238896F@eris.apache.org> Author: tabish Date: Fri Apr 13 18:13:46 2012 New Revision: 1325891 URL: http://svn.apache.org/viewvc?rev=1325891&view=rev Log: fix for: https://issues.apache.org/jira/browse/AMQNET-379 Don't shutdown the Connection if the transport is fault tolerant and a ShutdownInfo is received, just let the transport deal with it as it sees fit. Also updates some of the logging to make it clear what connection is logging and remove some uneeded info level logs. Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs?rev=1325891&r1=1325890&r2=1325891&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs Fri Apr 13 18:13:46 2012 @@ -542,7 +542,7 @@ namespace Apache.NMS.ActiveMQ try { - Tracer.Info("Connection.Close(): Closing Connection Now."); + Tracer.InfoFormat("Connection[{0}]: Closing Connection Now.", this.ConnectionId); this.closing.Value = true; if(this.advisoryConsumer != null) @@ -585,12 +585,12 @@ namespace Apache.NMS.ActiveMQ executor.Shutdown(); - Tracer.Info("Connection: Disposing of the Transport."); + Tracer.DebugFormat("Connection[{0}]: Disposing of the Transport.", this.ConnectionId); transport.Dispose(); } catch(Exception ex) { - Tracer.ErrorFormat("Error during connection close: {0}", ex); + Tracer.ErrorFormat("Connection[{0}]: Error during connection close: {1}", ConnectionId, ex); } finally { @@ -697,11 +697,15 @@ namespace Apache.NMS.ActiveMQ command.ObjectId = objectId; if(asyncClose) { - Tracer.Info("Asynchronously disposing of Connection."); + Tracer.DebugFormat("Connection[{0}]: Asynchronously disposing of Connection.", this.ConnectionId); if(connected.Value) { transport.Oneway(command); - Tracer.Info("Oneway command sent to broker."); + if (Tracer.IsDebugEnabled) + { + Tracer.DebugFormat("Connection[{0}]: Oneway command sent to broker: {1}", + this.ConnectionId, command); + } } } else @@ -709,9 +713,9 @@ namespace Apache.NMS.ActiveMQ // Ensure that the object is disposed to avoid potential race-conditions // of trying to re-create the same object in the broker faster than // the broker can dispose of the object. Allow up to 5 seconds to process. - Tracer.Info("Synchronously disposing of Connection."); + Tracer.DebugFormat("Connection[{0}]: Synchronously disposing of Connection.", this.ConnectionId); SyncRequest(command, TimeSpan.FromSeconds(5)); - Tracer.Info("Synchronously closed Connection."); + Tracer.DebugFormat("Connection[{0}]: Synchronously closed of Connection.", this.ConnectionId); } } catch // (BrokerException) @@ -825,9 +829,12 @@ namespace Apache.NMS.ActiveMQ } else if(command.IsShutdownInfo) { - if(!closing.Value && !closed.Value) + // Only terminate the connection if the transport we use is not fault + // tolerant otherwise we let the transport deal with the broker closing + // our connection and deal with IOException if it is sent to use. + if(!closing.Value && !closed.Value && this.transport != null && !this.transport.IsFaultTolerant) { - OnException(new NMSException("Broker closed this connection.")); + OnException(new NMSException("Broker closed this connection via Shutdown command.")); } } else if(command.IsProducerAck) @@ -840,7 +847,8 @@ namespace Apache.NMS.ActiveMQ { if(Tracer.IsDebugEnabled) { - Tracer.Debug("Connection: Received a new ProducerAck -> " + ack); + Tracer.DebugFormat("Connection[{0}]: Received a new ProducerAck -> ", + this.ConnectionId, ack); } producer.OnProducerAck(ack); @@ -865,13 +873,13 @@ namespace Apache.NMS.ActiveMQ } } - Tracer.Error(message + " : " + cause); + Tracer.ErrorFormat("Connection[{0}]: ConnectionError: " + message + " : " + cause, this.ConnectionId); OnException(new NMSConnectionException(message, cause)); } } else { - Tracer.Error("Unknown command: " + command); + Tracer.ErrorFormat("Connection[{0}]: Unknown command: " + command, this.ConnectionId); } } @@ -899,18 +907,15 @@ namespace Apache.NMS.ActiveMQ } } - Tracer.Error("No such consumer active: " + dispatch.ConsumerId); + Tracer.ErrorFormat("Connection[{0}]: No such consumer active: " + dispatch.ConsumerId, this.ConnectionId); } protected void OnKeepAliveCommand(ITransport commandTransport, KeepAliveInfo info) { - Tracer.Debug("Keep alive message received."); - try { - if(connected.Value) + if (connected.Value) { - Tracer.Debug("Returning KeepAliveInfo Response."); info.ResponseRequired = false; transport.Oneway(info); } @@ -942,7 +947,7 @@ namespace Apache.NMS.ActiveMQ } else { - Tracer.Debug("Async exception with no exception listener: " + error); + Tracer.DebugFormat("Connection[{0}]: Async exception with no exception listener: " + error, this.ConnectionId); } } } @@ -983,7 +988,7 @@ namespace Apache.NMS.ActiveMQ } catch(Exception ex) { - Tracer.Debug("Caught Exception While disposing of Transport: " + ex); + Tracer.DebugFormat("Connection[{0}]: Caught Exception While disposing of Transport: " + ex, this.ConnectionId); } this.brokerInfoReceived.countDown(); @@ -1004,7 +1009,7 @@ namespace Apache.NMS.ActiveMQ } catch(Exception ex) { - Tracer.Debug("Caught Exception While disposing of Sessions: " + ex); + Tracer.DebugFormat("Connection[{0}]: Caught Exception While disposing of Sessions: " + ex, this.ConnectionId); } } } @@ -1029,7 +1034,7 @@ namespace Apache.NMS.ActiveMQ if(Tracer.IsDebugEnabled) { - Tracer.Debug("transport interrupted, dispatchers: " + dispatchers.Count); + Tracer.DebugFormat("Connection[{0}]: Transport interrupted, dispatchers: " + dispatchers.Count, this.ConnectionId); } SignalInterruptionProcessingNeeded(); @@ -1042,7 +1047,7 @@ namespace Apache.NMS.ActiveMQ } catch(Exception ex) { - Tracer.Warn("Exception while clearing messages: " + ex.Message); + Tracer.WarnFormat("Connection[{0}]: Exception while clearing messages: " + ex.Message, this.ConnectionId); Tracer.Warn(ex.StackTrace); } } @@ -1173,8 +1178,8 @@ namespace Apache.NMS.ActiveMQ { if(!closed.Value && cdl.Remaining > 0) { - Tracer.Warn("dispatch paused, waiting for outstanding dispatch interruption " + - "processing (" + cdl.Remaining + ") to complete.."); + Tracer.WarnFormat("Connection[{0}]: Dispatch paused, waiting for outstanding dispatch interruption " + + "processing (" + cdl.Remaining + ") to complete..", this.ConnectionId); cdl.await(TimeSpan.FromSeconds(10)); } @@ -1205,7 +1210,7 @@ namespace Apache.NMS.ActiveMQ { if(Tracer.IsDebugEnabled) { - Tracer.Debug("transportInterruptionProcessingComplete for: " + this.info.ConnectionId); + Tracer.DebugFormat("Connection[{0}]: transportInterruptionProcessingComplete.", this.info.ConnectionId); } this.transportInterruptionProcessingComplete = null; @@ -1216,8 +1221,8 @@ namespace Apache.NMS.ActiveMQ failoverTransport.ConnectionInterruptProcessingComplete(this.info.ConnectionId); if(Tracer.IsDebugEnabled) { - Tracer.Debug("notified failover transport (" + failoverTransport + - ") of interruption completion for: " + this.info.ConnectionId); + Tracer.DebugFormat("Connection[{0}]: notified failover transport (" + failoverTransport + + ") of interruption completion.", this.ConnectionId); } } } @@ -1232,8 +1237,8 @@ namespace Apache.NMS.ActiveMQ failoverTransport.StateTracker.TransportInterrupted(this.info.ConnectionId); if(Tracer.IsDebugEnabled) { - Tracer.Debug("notified failover transport (" + failoverTransport + - ") of pending interruption processing for: " + this.info.ConnectionId); + Tracer.DebugFormat("Connection[{0}]: notified failover transport (" + failoverTransport + + ") of pending interruption processing.", this.ConnectionId); } } }