Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 22534 invoked from network); 28 Jan 2011 17:05:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Jan 2011 17:05:21 -0000 Received: (qmail 52889 invoked by uid 500); 28 Jan 2011 17:05:21 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 52826 invoked by uid 500); 28 Jan 2011 17:05:20 -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 52819 invoked by uid 99); 28 Jan 2011 17:05:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jan 2011 17:05:19 +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, 28 Jan 2011 17:05:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 42C7623888EC; Fri, 28 Jan 2011 17:04:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1064779 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transactions/RecoveryFileLogger.cs Date: Fri, 28 Jan 2011 17:04:56 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110128170456.42C7623888EC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Fri Jan 28 17:04:55 2011 New Revision: 1064779 URL: http://svn.apache.org/viewvc?rev=1064779&view=rev Log: Fix some issues with finding the file and removing it. Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transactions/RecoveryFileLogger.cs Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transactions/RecoveryFileLogger.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transactions/RecoveryFileLogger.cs?rev=1064779&r1=1064778&r2=1064779&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transactions/RecoveryFileLogger.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transactions/RecoveryFileLogger.cs Fri Jan 28 17:04:55 2011 @@ -30,13 +30,13 @@ namespace Apache.NMS.ActiveMQ.Transactio { private string location; private string resourceManagerId; - private object syncRoot = new object(); + private readonly object syncRoot = new object(); public RecoveryFileLogger() { // Set the path by default to the location of the executing assembly. // May need to change this to current working directory, not sure. - this.location = Assembly.GetExecutingAssembly().Location; + this.location = ""; } /// @@ -70,12 +70,11 @@ namespace Apache.NMS.ActiveMQ.Transactio { lock (syncRoot) { - string filename = Location + ResourceManagerId + ".bin"; RecoveryInformation info = new RecoveryInformation(xid, recoveryInformation); - Tracer.Debug("Serializing Recovery Info to file: " + filename); + Tracer.Debug("Serializing Recovery Info to file: " + Filename); IFormatter formatter = new BinaryFormatter(); - using (FileStream recoveryLog = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write)) + using (FileStream recoveryLog = new FileStream(Filename, FileMode.OpenOrCreate, FileAccess.Write)) { formatter.Serialize(recoveryLog, info); } @@ -93,7 +92,7 @@ namespace Apache.NMS.ActiveMQ.Transactio KeyValuePair[] result = new KeyValuePair[0]; RecoveryInformation info = TryOpenRecoveryInfoFile(); - if(result != null) + if (info != null) { result = new KeyValuePair[1]; result[0] = new KeyValuePair(info.Xid, info.TxRecoveryInfo); @@ -106,12 +105,10 @@ namespace Apache.NMS.ActiveMQ.Transactio { lock (syncRoot) { - string filename = Location + ResourceManagerId + ".bin"; - try { - Tracer.Debug("Attempting to remove stale Recovery Info file: " + filename); - File.Delete(filename); + Tracer.Debug("Attempting to remove stale Recovery Info file: " + Filename); + File.Delete(Filename); } catch(Exception ex) { @@ -125,12 +122,10 @@ namespace Apache.NMS.ActiveMQ.Transactio { lock (syncRoot) { - string filename = Location + ResourceManagerId + ".bin"; - try { - Tracer.Debug("Attempting to remove stale Recovery Info file: " + filename); - File.Delete(filename); + Tracer.Debug("Attempting to remove stale Recovery Info file: " + Filename); + File.Delete(Filename); } catch(Exception ex) { @@ -147,6 +142,11 @@ namespace Apache.NMS.ActiveMQ.Transactio #region Recovery File Opeations + private string Filename + { + get { return Location + ResourceManagerId + ".bin"; } + } + [Serializable] private sealed class RecoveryInformation {