Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 47521 invoked from network); 8 Apr 2008 17:43:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Apr 2008 17:43:02 -0000 Received: (qmail 70794 invoked by uid 500); 8 Apr 2008 17:43:01 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 70771 invoked by uid 500); 8 Apr 2008 17:43:01 -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 70757 invoked by uid 99); 8 Apr 2008 17:43:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Apr 2008 10:43:01 -0700 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.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Apr 2008 17:42:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D08591A9832; Tue, 8 Apr 2008 10:42:36 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r646014 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src: main/csharp/ test/csharp/ Date: Tue, 08 Apr 2008 17:42:35 -0000 To: commits@activemq.apache.org From: jgomes@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080408174236.D08591A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jgomes Date: Tue Apr 8 10:42:27 2008 New Revision: 646014 URL: http://svn.apache.org/viewvc?rev=646014&view=rev Log: Add more robust try/catch handling. Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CommonAssemblyInfo.cs activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/CommonAssemblyInfo.cs Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CommonAssemblyInfo.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CommonAssemblyInfo.cs?rev=646014&r1=646013&r2=646014&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CommonAssemblyInfo.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CommonAssemblyInfo.cs Tue Apr 8 10:42:27 2008 @@ -5,7 +5,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.832 +// Runtime Version:2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs?rev=646014&r1=646013&r2=646014&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs Tue Apr 8 10:42:27 2008 @@ -138,11 +138,14 @@ answer.ConnectionId = connectionId; answer.UserName = userName; answer.Password = password; - answer.ClientId = clientId; - if (clientId == null) + if(clientId == null) { answer.ClientId = CreateNewGuid(); } + else + { + answer.ClientId = clientId; + } return answer; } Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs?rev=646014&r1=646013&r2=646014&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs Tue Apr 8 10:42:27 2008 @@ -152,21 +152,25 @@ { return; } - } - // wake up any pending dequeue() call on the dispatcher - dispatcher.Close(); - session.DisposeOf(info.ConsumerId); - session = null; + try + { + // wake up any pending dequeue() call on the dispatcher + dispatcher.Close(); + session.DisposeOf(info.ConsumerId); - lock(this) - { - if(ackSession != null) + if(ackSession != null) + { + ackSession.Close(); + } + } + catch(Exception ex) { - ackSession.Close(); - ackSession = null; + Tracer.ErrorFormat("Error during consumer close: {0}", ex); } + session = null; + ackSession = null; closed = true; } } Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs?rev=646014&r1=646013&r2=646014&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageProducer.cs Tue Apr 8 10:42:27 2008 @@ -87,13 +87,17 @@ { return; } - } - session.DisposeOf(info.ProducerId); - session = null; + try + { + session.DisposeOf(info.ProducerId); + } + catch(Exception ex) + { + Tracer.ErrorFormat("Error during producer close: {0}", ex); + } - lock(this) - { + session = null; closed = true; } } Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs?rev=646014&r1=646013&r2=646014&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs Tue Apr 8 10:42:27 2008 @@ -44,6 +44,7 @@ private readonly TransactionContext transactionContext; internal bool startedAsyncDelivery = false; private bool disposed = false; + private bool closed = false; public Session(Connection connection, SessionInfo info, AcknowledgementMode acknowledgementMode) { @@ -176,6 +177,41 @@ disposed = true; } + public void Close() + { + lock(this) + { + if(closed) + { + return; + } + + try + { + connection.RemoveSession(this); + StopAsyncDelivery(); + foreach(MessageConsumer consumer in GetConsumers()) + { + consumer.Close(); + } + consumers.Clear(); + + foreach(MessageProducer producer in GetProducers()) + { + producer.Close(); + } + producers.Clear(); + } + catch(Exception ex) + { + Tracer.ErrorFormat("Error during session close: {0}", ex); + } + + connection = null; + closed = true; + } + } + public IMessageProducer CreateProducer() { return CreateProducer(null); @@ -386,24 +422,6 @@ public bool Transacted { get { return acknowledgementMode == AcknowledgementMode.Transactional; } - } - - public void Close() - { - connection.RemoveSession(this); - StopAsyncDelivery(); - foreach(MessageConsumer consumer in GetConsumers()) - { - consumer.Close(); - } - consumers.Clear(); - - foreach(MessageProducer producer in GetProducers()) - { - producer.Close(); - } - producers.Clear(); - connection = null; } #endregion Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/CommonAssemblyInfo.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/CommonAssemblyInfo.cs?rev=646014&r1=646013&r2=646014&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/CommonAssemblyInfo.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/CommonAssemblyInfo.cs Tue Apr 8 10:42:27 2008 @@ -5,7 +5,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.832 +// Runtime Version:2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated.