You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/09/01 21:15:43 UTC
svn commit: r991661 - in
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp: ./
Commands/ OpenWire/ State/ Threads/ Transport/ Transport/Discovery/
Transport/Discovery/Multicast/ Transport/Failover/ Transport/Mock/
Transport/Tcp/ Util/
Author: tabish
Date: Wed Sep 1 19:15:42 2010
New Revision: 991661
URL: http://svn.apache.org/viewvc?rev=991661&view=rev
Log:
Several small cleanups of the source.
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/BrokerException.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQObjectMessage.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CompressionPolicy.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConsumerClosedException.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/IOException.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/OpenWire/BaseDataStreamMarshaller.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/IMarshallerFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/SessionExecutor.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConsumerState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ProducerState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/CompositeTaskRunner.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DedicatedTaskRunner.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DefaultThreadPools.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/PooledTaskRunner.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/BackupTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/InactivityMonitor.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/WireFormatNegotiator.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/ActiveMQMessageTransformation.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FifoMessageDispatchChannel.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MessageDispatchChannel.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/SimplePriorityMessageDispatchChannel.cs
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/BrokerException.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/BrokerException.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/BrokerException.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/BrokerException.cs Wed Sep 1 19:15:42 2010
@@ -27,7 +27,7 @@ namespace Apache.NMS.ActiveMQ
[Serializable]
public class BrokerException : NMSException
{
- private BrokerError brokerError = null;
+ private readonly BrokerError brokerError = null;
public BrokerException()
: base("Broker failed with missing exception log")
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQObjectMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQObjectMessage.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQObjectMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ActiveMQObjectMessage.cs Wed Sep 1 19:15:42 2010
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-using System.Collections;
using System.IO;
#if !(PocketPC||NETCF||NETCF_2_0)
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CompressionPolicy.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CompressionPolicy.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CompressionPolicy.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CompressionPolicy.cs Wed Sep 1 19:15:42 2010
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-using System;
using System.IO;
namespace Apache.NMS.ActiveMQ
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs Wed Sep 1 19:15:42 2010
@@ -706,8 +706,8 @@ namespace Apache.NMS.ActiveMQ
}
else if(command is ProducerAck)
{
- ProducerAck ack = (ProducerAck) command;
- if(ack != null && ack.ProducerId != null)
+ ProducerAck ack = (ProducerAck) command as ProducerAck;
+ if(ack.ProducerId != null)
{
MessageProducer producer = producers[ack.ProducerId] as MessageProducer;
if(producer != null)
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=991661&r1=991660&r2=991661&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 Wed Sep 1 19:15:42 2010
@@ -16,12 +16,9 @@
*/
using System;
-using System.Collections;
using System.Collections.Specialized;
using Apache.NMS.ActiveMQ.Util;
-using Apache.NMS.ActiveMQ.Commands;
using Apache.NMS.ActiveMQ.Transport;
-using Apache.NMS;
using Apache.NMS.Util;
using Apache.NMS.Policies;
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionMetaData.cs Wed Sep 1 19:15:42 2010
@@ -25,17 +25,17 @@ namespace Apache.NMS.ActiveMQ
/// </summary>
public class ConnectionMetaData : IConnectionMetaData
{
- private int nmsMajorVersion;
- private int nmsMinorVersion;
+ private readonly int nmsMajorVersion;
+ private readonly int nmsMinorVersion;
- private string nmsProviderName;
- private string nmsVersion;
+ private readonly string nmsProviderName;
+ private readonly string nmsVersion;
- private int providerMajorVersion;
- private int providerMinorVersion;
- private string providerVersion;
+ private readonly int providerMajorVersion;
+ private readonly int providerMinorVersion;
+ private readonly string providerVersion;
- private string[] nmsxProperties;
+ private readonly string[] nmsxProperties;
public ConnectionMetaData()
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConsumerClosedException.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConsumerClosedException.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConsumerClosedException.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConsumerClosedException.cs Wed Sep 1 19:15:42 2010
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-using Apache.NMS;
using System;
namespace Apache.NMS.ActiveMQ
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/IOException.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/IOException.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/IOException.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/IOException.cs Wed Sep 1 19:15:42 2010
@@ -17,10 +17,6 @@
using System;
-using Apache.NMS.ActiveMQ.Commands;
-using System.Text;
-using Apache.NMS;
-
namespace Apache.NMS.ActiveMQ
{
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=991661&r1=991660&r2=991661&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 Wed Sep 1 19:15:42 2010
@@ -16,12 +16,10 @@
*/
using System;
using System.Threading;
-using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using Apache.NMS.ActiveMQ.Commands;
using Apache.NMS.ActiveMQ.Util;
-using Apache.NMS;
using Apache.NMS.Util;
namespace Apache.NMS.ActiveMQ
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=991661&r1=991660&r2=991661&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 Wed Sep 1 19:15:42 2010
@@ -43,7 +43,7 @@ namespace Apache.NMS.ActiveMQ
private bool disableMessageTimestamp = false;
protected bool disposed = false;
- private MessageTransformation messageTransformation;
+ private readonly MessageTransformation messageTransformation;
public MessageProducer(Session session, ProducerId id, ActiveMQDestination destination, TimeSpan requestTimeout)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/BaseDataStreamMarshaller.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/BaseDataStreamMarshaller.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/BaseDataStreamMarshaller.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/BaseDataStreamMarshaller.cs Wed Sep 1 19:15:42 2010
@@ -16,7 +16,6 @@
*/
using Apache.NMS.ActiveMQ.Commands;
using System;
-using System.Collections;
using System.IO;
using System.Text;
@@ -30,7 +29,7 @@ namespace Apache.NMS.ActiveMQ.OpenWire
public abstract class BaseDataStreamMarshaller
{
- private static String[] HEX_TABLE = new String[]{
+ private static readonly String[] HEX_TABLE = new String[]{
"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f",
"20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f",
@@ -103,21 +102,6 @@ namespace Apache.NMS.ActiveMQ.OpenWire
BinaryReader dataIn,
BooleanStream bs)
{
- /*
- if (wireFormat.isCacheEnabled()) {
- if (bs.ReadBoolean()) {
- short index = dataIndataIn.ReadInt16()Int16();
- DataStructure value = wireFormat.UnmarshalNestedObject(dataIn, bs);
- wireFormat.setInUnmarshallCache(index, value);
- return value;
- } else {
- short index = dataIn.ReadInt16();
- return wireFormat.getFromUnmarshallCache(index);
- }
- } else {
- return wireFormat.UnmarshalNestedObject(dataIn, bs);
- }
- */
return wireFormat.TightUnmarshalNestedObject(dataIn, bs);
}
@@ -126,21 +110,6 @@ namespace Apache.NMS.ActiveMQ.OpenWire
DataStructure o,
BooleanStream bs)
{
- /*
- if (wireFormat.isCacheEnabled()) {
- Short index = wireFormat.getMarshallCacheIndex(o);
- bs.WriteBoolean(index == null);
- if (index == null) {
- int rc = wireFormat.Marshal1NestedObject(o, bs);
- wireFormat.addToMarshallCache(o);
- return 2 + rc;
- } else {
- return 2;
- }
- } else {
- return wireFormat.Marshal1NestedObject(o, bs);
- }
- */
return wireFormat.TightMarshalNestedObject1(o, bs);
}
@@ -150,29 +119,14 @@ namespace Apache.NMS.ActiveMQ.OpenWire
BinaryWriter dataOut,
BooleanStream bs)
{
- /*
- if (wireFormat.isCacheEnabled()) {
- Short index = wireFormat.getMarshallCacheIndex(o);
- if (bs.ReadBoolean()) {
- dataOut.Write(index.shortValue(), dataOut);
- wireFormat.Marshal2NestedObject(o, dataOut, bs);
- } else {
- dataOut.Write(index.shortValue(), dataOut);
- }
- } else {
- wireFormat.Marshal2NestedObject(o, dataOut, bs);
- }
- */
wireFormat.TightMarshalNestedObject2(o, dataOut, bs);
}
-
-
protected virtual String TightUnmarshalString(BinaryReader dataIn, BooleanStream bs)
{
- if (bs.ReadBoolean())
+ if(bs.ReadBoolean())
{
- if (bs.ReadBoolean())
+ if(bs.ReadBoolean())
{
return ReadAsciiString(dataIn);
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/IMarshallerFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/IMarshallerFactory.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/IMarshallerFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/IMarshallerFactory.cs Wed Sep 1 19:15:42 2010
@@ -14,9 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-using System;
-using System.Text;
-using Apache.NMS.ActiveMQ.OpenWire;
namespace Apache.NMS.ActiveMQ.OpenWire
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs Wed Sep 1 19:15:42 2010
@@ -31,7 +31,7 @@ namespace Apache.NMS.ActiveMQ.OpenWire
public class OpenWireFormat : IWireFormat
{
private readonly object marshalLock = new object();
- private BaseDataStreamMarshaller[] dataMarshallers;
+ private readonly BaseDataStreamMarshaller[] dataMarshallers;
private const byte NULL_TYPE = 0;
private int version;
@@ -43,7 +43,7 @@ namespace Apache.NMS.ActiveMQ.OpenWire
private long maxInactivityDuration = 0;
private long maxInactivityDurationInitialDelay = 0;
private int cacheSize = 0;
- private int minimumVersion = 1;
+ private const int minimumVersion = 1;
private WireFormatInfo preferredWireFormatInfo = new WireFormatInfo();
private ITransport transport;
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/PrefetchPolicy.cs Wed Sep 1 19:15:42 2010
@@ -82,7 +82,7 @@ namespace Apache.NMS.ActiveMQ
this.durableTopicPrefetch = value;
}
- private int RestrictToMaximum(int value)
+ private static int RestrictToMaximum(int value)
{
return System.Math.Min(value, MAX_PREFETCH_SIZE);
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/QueueBrowser.cs Wed Sep 1 19:15:42 2010
@@ -17,13 +17,9 @@
using System;
using System.Collections;
-using System.Collections.Generic;
-using System.Text;
using Apache.NMS.ActiveMQ.Commands;
using System.Threading;
using Apache.NMS.Util;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
namespace Apache.NMS.ActiveMQ
{
@@ -306,7 +302,7 @@ namespace Apache.NMS.ActiveMQ
public class BrowsingMessageConsumer : MessageConsumer
{
- private QueueBrowser parent;
+ private readonly QueueBrowser parent;
public BrowsingMessageConsumer(QueueBrowser parent, Session session, ConsumerId id, ActiveMQDestination destination,
String name, String selector, int prefetch, int maxPendingMessageCount,
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=991661&r1=991660&r2=991661&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 Wed Sep 1 19:15:42 2010
@@ -20,7 +20,6 @@ using System.Collections;
using System.Threading;
using Apache.NMS.ActiveMQ.Commands;
using Apache.NMS.ActiveMQ.Util;
-using Apache.NMS.Util;
namespace Apache.NMS.ActiveMQ
{
@@ -58,7 +57,7 @@ namespace Apache.NMS.ActiveMQ
private TimeSpan disposeStopTimeout = TimeSpan.FromMilliseconds(30000);
private TimeSpan closeStopTimeout = TimeSpan.FromMilliseconds(Timeout.Infinite);
private TimeSpan requestTimeout;
- private AcknowledgementMode acknowledgementMode;
+ private readonly AcknowledgementMode acknowledgementMode;
public Session(Connection connection, SessionInfo info, AcknowledgementMode acknowledgementMode, bool dispatchAsync)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/SessionExecutor.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/SessionExecutor.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/SessionExecutor.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/SessionExecutor.cs Wed Sep 1 19:15:42 2010
@@ -28,8 +28,8 @@ namespace Apache.NMS.ActiveMQ
private readonly MessageDispatchChannel messageQueue = null;
private TaskRunner taskRunner = null;
- private Session session = null;
- private IDictionary consumers = null;
+ private readonly Session session = null;
+ private readonly IDictionary consumers = null;
public SessionExecutor(Session session, IDictionary consumers)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionState.cs Wed Sep 1 19:15:42 2010
@@ -26,12 +26,12 @@ namespace Apache.NMS.ActiveMQ.State
{
ConnectionInfo info;
- private AtomicDictionary<TransactionId, TransactionState> transactions = new AtomicDictionary<TransactionId, TransactionState>();
- private AtomicDictionary<SessionId, SessionState> sessions = new AtomicDictionary<SessionId, SessionState>();
- private AtomicCollection<DestinationInfo> tempDestinations = new AtomicCollection<DestinationInfo>();
- private Atomic<bool> _shutdown = new Atomic<bool>(false);
+ private readonly AtomicDictionary<TransactionId, TransactionState> transactions = new AtomicDictionary<TransactionId, TransactionState>();
+ private readonly AtomicDictionary<SessionId, SessionState> sessions = new AtomicDictionary<SessionId, SessionState>();
+ private readonly AtomicCollection<DestinationInfo> tempDestinations = new AtomicCollection<DestinationInfo>();
+ private readonly Atomic<bool> _shutdown = new Atomic<bool>(false);
private bool connectionInterruptProcessingComplete = true;
- private Dictionary<ConsumerId, ConsumerInfo> recoveringPullConsumers =
+ private readonly Dictionary<ConsumerId, ConsumerInfo> recoveringPullConsumers =
new Dictionary<ConsumerId, ConsumerInfo>();
public ConnectionState(ConnectionInfo info)
@@ -116,7 +116,7 @@ namespace Apache.NMS.ActiveMQ.State
}
System.Diagnostics.Debug.Assert(false,
string.Format("Session '{0}' did not exist in the sessions collection.\n\nSessions:-\n{1}", id, sessionList));
- throw ex;
+ throw;
}
#endif
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConnectionStateTracker.cs Wed Sep 1 19:15:42 2010
@@ -18,7 +18,6 @@
using System;
using System.Collections.Generic;
-using Apache.NMS.Util;
using Apache.NMS.ActiveMQ.Commands;
using Apache.NMS.ActiveMQ.Transport;
@@ -31,7 +30,7 @@ namespace Apache.NMS.ActiveMQ.State
public class ConnectionStateTracker : CommandVisitorAdapter
{
- private static Tracked TRACKED_RESPONSE_MARKER = new Tracked(null);
+ private static readonly Tracked TRACKED_RESPONSE_MARKER = new Tracked(null);
protected Dictionary<ConnectionId, ConnectionState> connectionStates = new Dictionary<ConnectionId, ConnectionState>();
@@ -43,8 +42,8 @@ namespace Apache.NMS.ActiveMQ.State
private bool _trackMessages = true;
private int _maxCacheSize = 256;
private int currentCacheSize;
- private Dictionary<MessageId, Message> messageCache = new Dictionary<MessageId, Message>();
- private Queue<MessageId> messageCacheFIFO = new Queue<MessageId>();
+ private readonly Dictionary<MessageId, Message> messageCache = new Dictionary<MessageId, Message>();
+ private readonly Queue<MessageId> messageCacheFIFO = new Queue<MessageId>();
protected void RemoveEldestInCache()
{
@@ -61,8 +60,8 @@ namespace Apache.NMS.ActiveMQ.State
private class RemoveTransactionAction : ThreadSimulator
{
- private TransactionInfo info;
- private ConnectionStateTracker cst;
+ private readonly TransactionInfo info;
+ private readonly ConnectionStateTracker cst;
public RemoveTransactionAction(TransactionInfo info, ConnectionStateTracker aCst)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConsumerState.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConsumerState.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConsumerState.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ConsumerState.cs Wed Sep 1 19:15:42 2010
@@ -24,7 +24,7 @@ namespace Apache.NMS.ActiveMQ.State
public class ConsumerState
{
- ConsumerInfo info;
+ readonly ConsumerInfo info;
public ConsumerState(ConsumerInfo info)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ProducerState.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ProducerState.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ProducerState.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/ProducerState.cs Wed Sep 1 19:15:42 2010
@@ -23,7 +23,7 @@ namespace Apache.NMS.ActiveMQ.State
{
public class ProducerState
{
- ProducerInfo info;
+ readonly ProducerInfo info;
public ProducerState(ProducerInfo info)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SessionState.cs Wed Sep 1 19:15:42 2010
@@ -23,11 +23,11 @@ namespace Apache.NMS.ActiveMQ.State
{
public class SessionState
{
- SessionInfo info;
+ readonly SessionInfo info;
- private AtomicDictionary<ProducerId, ProducerState> producers = new AtomicDictionary<ProducerId, ProducerState>();
- private AtomicDictionary<ConsumerId, ConsumerState> consumers = new AtomicDictionary<ConsumerId, ConsumerState>();
- private Atomic<bool> _shutdown = new Atomic<bool>(false);
+ private readonly AtomicDictionary<ProducerId, ProducerState> producers = new AtomicDictionary<ProducerId, ProducerState>();
+ private readonly AtomicDictionary<ConsumerId, ConsumerState> consumers = new AtomicDictionary<ConsumerId, ConsumerState>();
+ private readonly Atomic<bool> _shutdown = new Atomic<bool>(false);
public SessionState(SessionInfo info)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/SynchronizedObjects.cs Wed Sep 1 19:15:42 2010
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-using System;
using System.Collections;
using System.Collections.Generic;
@@ -24,7 +23,7 @@ namespace Apache.NMS.ActiveMQ.State
public class AtomicCollection<TValue>
where TValue : class
{
- private ArrayList _collection = new ArrayList();
+ private readonly ArrayList _collection = new ArrayList();
public AtomicCollection()
{
@@ -151,7 +150,7 @@ namespace Apache.NMS.ActiveMQ.State
where TKey : class
where TValue : class
{
- private Dictionary<TKey, TValue> _dictionary = new Dictionary<TKey, TValue>();
+ private readonly Dictionary<TKey, TValue> _dictionary = new Dictionary<TKey, TValue>();
public void Clear()
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/State/TransactionState.cs Wed Sep 1 19:15:42 2010
@@ -25,9 +25,9 @@ namespace Apache.NMS.ActiveMQ.State
public class TransactionState
{
- private List<Command> commands = new List<Command>();
- private TransactionId id;
- private Atomic<bool> _shutdown = new Atomic<bool>(false);
+ private readonly List<Command> commands = new List<Command>();
+ private readonly TransactionId id;
+ private readonly Atomic<bool> _shutdown = new Atomic<bool>(false);
private bool prepared;
private int preparedResult;
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/CompositeTaskRunner.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/CompositeTaskRunner.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/CompositeTaskRunner.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/CompositeTaskRunner.cs Wed Sep 1 19:15:42 2010
@@ -27,8 +27,8 @@ namespace Apache.NMS.ActiveMQ.Threads
public class CompositeTaskRunner : TaskRunner
{
private readonly Mutex mutex = new Mutex();
- private Thread theThread = null;
- private LinkedList<CompositeTask> tasks = new LinkedList<CompositeTask>();
+ private readonly Thread theThread = null;
+ private readonly LinkedList<CompositeTask> tasks = new LinkedList<CompositeTask>();
private bool terminated = false;
private bool pending = false;
@@ -36,8 +36,7 @@ namespace Apache.NMS.ActiveMQ.Threads
public CompositeTaskRunner()
{
- this.theThread = new Thread(Run);
- this.theThread.IsBackground = true;
+ this.theThread = new Thread(Run) {IsBackground = true};
this.theThread.Start();
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DedicatedTaskRunner.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DedicatedTaskRunner.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DedicatedTaskRunner.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DedicatedTaskRunner.cs Wed Sep 1 19:15:42 2010
@@ -26,8 +26,8 @@ namespace Apache.NMS.ActiveMQ.Threads
public class DedicatedTaskRunner : TaskRunner
{
private readonly Mutex mutex = new Mutex();
- private Thread theThread = null;
- private Task task = null;
+ private readonly Thread theThread = null;
+ private readonly Task task = null;
private bool terminated = false;
private bool pending = false;
@@ -42,8 +42,7 @@ namespace Apache.NMS.ActiveMQ.Threads
this.task = task;
- this.theThread = new Thread(Run);
- this.theThread.IsBackground = true;
+ this.theThread = new Thread(Run) {IsBackground = true};
this.theThread.Start();
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DefaultThreadPools.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DefaultThreadPools.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DefaultThreadPools.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/DefaultThreadPools.cs Wed Sep 1 19:15:42 2010
@@ -19,7 +19,7 @@ namespace Apache.NMS.ActiveMQ.Threads
{
public class DefaultThreadPools
{
- private static TaskRunnerFactory DEFAULT_TASK_RUNNER_FACTORY = new TaskRunnerFactory();
+ private static readonly TaskRunnerFactory DEFAULT_TASK_RUNNER_FACTORY = new TaskRunnerFactory();
private DefaultThreadPools()
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/PooledTaskRunner.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/PooledTaskRunner.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/PooledTaskRunner.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Threads/PooledTaskRunner.cs Wed Sep 1 19:15:42 2010
@@ -22,9 +22,9 @@ namespace Apache.NMS.ActiveMQ.Threads
{
class PooledTaskRunner : TaskRunner
{
- private int maxIterationsPerRun;
- private Task task;
- private Object runable = new Object();
+ private readonly int maxIterationsPerRun;
+ private readonly Task task;
+ private readonly Object runable = new Object();
private bool queued;
private bool _shutdown;
private bool iterating;
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs Wed Sep 1 19:15:42 2010
@@ -30,8 +30,8 @@ namespace Apache.NMS.ActiveMQ
public class TransactionContext
{
private TransactionId transactionId;
- private Session session;
- private ArrayList synchronizations = ArrayList.Synchronized(new ArrayList());
+ private readonly Session session;
+ private readonly ArrayList synchronizations = ArrayList.Synchronized(new ArrayList());
public TransactionContext(Session session)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/DiscoveryTransportFactory.cs Wed Sep 1 19:15:42 2010
@@ -28,7 +28,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
private const int TIMEOUT_IN_SECONDS = 20;
private static Uri discoveredUri;
- private static MulticastDiscoveryAgent agent;
+ private static readonly MulticastDiscoveryAgent agent;
private static string currentServiceName;
private static readonly object uriLock = new object();
private static readonly AutoResetEvent discoveredUriEvent = new AutoResetEvent(false);
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Discovery/Multicast/MulticastDiscoveryAgent.cs Wed Sep 1 19:15:42 2010
@@ -44,7 +44,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
private const int SOCKET_TIMEOUT_MILLISECONDS = 500;
private string group;
- private object stopstartSemaphore = new object();
+ private readonly object stopstartSemaphore = new object();
private bool isStarted = false;
private Uri discoveryUri;
private Socket multicastSocket;
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/BackupTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/BackupTransport.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/BackupTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/BackupTransport.cs Wed Sep 1 19:15:42 2010
@@ -22,7 +22,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
{
class BackupTransport
{
- private FailoverTransport failoverTransport;
+ private readonly FailoverTransport failoverTransport;
private ITransport transport;
private Uri uri;
private bool disposed;
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs Wed Sep 1 19:15:42 2010
@@ -33,26 +33,26 @@ namespace Apache.NMS.ActiveMQ.Transport.
public class FailoverTransport : ICompositeTransport, IComparable
{
private static int idCounter = 0;
- private int id;
+ private readonly int id;
private bool disposed;
private bool connected;
- private List<Uri> uris = new List<Uri>();
- private List<Uri> updated = new List<Uri>();
+ private readonly List<Uri> uris = new List<Uri>();
+ private readonly List<Uri> updated = new List<Uri>();
private CommandHandler commandHandler;
private ExceptionHandler exceptionHandler;
private InterruptedHandler interruptedHandler;
private ResumedHandler resumedHandler;
- private Mutex reconnectMutex = new Mutex();
- private Mutex backupMutex = new Mutex();
- private Mutex sleepMutex = new Mutex();
- private ConnectionStateTracker stateTracker = new ConnectionStateTracker();
- private Dictionary<int, Command> requestMap = new Dictionary<int, Command>();
+ private readonly Mutex reconnectMutex = new Mutex();
+ private readonly Mutex backupMutex = new Mutex();
+ private readonly Mutex sleepMutex = new Mutex();
+ private readonly ConnectionStateTracker stateTracker = new ConnectionStateTracker();
+ private readonly Dictionary<int, Command> requestMap = new Dictionary<int, Command>();
private Uri connectedTransportURI;
private Uri failedConnectTransportURI;
- private AtomicReference<ITransport> connectedTransport = new AtomicReference<ITransport>(null);
+ private readonly AtomicReference<ITransport> connectedTransport = new AtomicReference<ITransport>(null);
private TaskRunner reconnectTask = null;
private bool started;
@@ -71,7 +71,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
private Exception connectionFailure;
private bool firstConnection = true;
private bool backup = false;
- private List<BackupTransport> backups = new List<BackupTransport>();
+ private readonly List<BackupTransport> backups = new List<BackupTransport>();
private int backupPoolSize = 1;
private bool trackMessages = false;
private int maxCacheSize = 256;
@@ -96,7 +96,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
private class FailoverTask : Task
{
- private FailoverTransport parent;
+ private readonly FailoverTransport parent;
public FailoverTask(FailoverTransport p)
{
@@ -321,7 +321,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
/// </summary>
/// <param name="command"></param>
/// <returns>Returns true if the command is one sent when a connection is being closed.</returns>
- private bool IsShutdownCommand(Command command)
+ private static bool IsShutdownCommand(Command command)
{
return (command != null && (command.IsShutdownInfo || command is RemoveInfo));
}
@@ -958,9 +958,8 @@ namespace Apache.NMS.ActiveMQ.Transport.
}, uri, this);
// initiate a thread to try connecting to broker
- Thread thread = new Thread(connector.DoConnect);
- thread.Name = uri.ToString();
- thread.Start();
+ Thread thread = new Thread(connector.DoConnect) {Name = uri.ToString()};
+ thread.Start();
}
else
{
@@ -1080,17 +1079,17 @@ namespace Apache.NMS.ActiveMQ.Transport.
/// <summary>
/// callback to properly set chosen transport
/// </summary>
- SetTransport _setTransport;
+ readonly SetTransport _setTransport;
/// <summary>
/// Uri to try connecting to
/// </summary>
- Uri _uri;
+ readonly Uri _uri;
/// <summary>
/// Failover transport issuing the connection attempt
/// </summary>
- private FailoverTransport _transport;
+ private readonly FailoverTransport _transport;
/// <summary>
/// Initializes a new instance of the <see cref="Connector"/> class.
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=991661&r1=991660&r2=991661&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 Wed Sep 1 19:15:42 2010
@@ -30,20 +30,20 @@ namespace Apache.NMS.ActiveMQ.Transport
/// </summary>
public class InactivityMonitor : TransportFilter
{
- private Atomic<bool> monitorStarted = new Atomic<bool>(false);
+ private readonly Atomic<bool> monitorStarted = new Atomic<bool>(false);
- private Atomic<bool> commandSent = new Atomic<bool>(false);
- private Atomic<bool> commandReceived = new Atomic<bool>(false);
+ private readonly Atomic<bool> commandSent = new Atomic<bool>(false);
+ private readonly Atomic<bool> commandReceived = new Atomic<bool>(false);
- private Atomic<bool> failed = new Atomic<bool>(false);
- private Atomic<bool> inRead = new Atomic<bool>(false);
- private Atomic<bool> inWrite = new Atomic<bool>(false);
+ private readonly Atomic<bool> failed = new Atomic<bool>(false);
+ private readonly Atomic<bool> inRead = new Atomic<bool>(false);
+ private readonly Atomic<bool> inWrite = new Atomic<bool>(false);
private CompositeTaskRunner asyncTasks;
private AsyncSignalReadErrorkTask asyncErrorTask;
private AsyncWriteTask asyncWriteTask;
- private Mutex monitor = new Mutex();
+ private readonly Mutex monitor = new Mutex();
private Timer connectionCheckTimer;
@@ -70,7 +70,7 @@ namespace Apache.NMS.ActiveMQ.Transport
set { this.initialDelayTime = value; }
}
- private Atomic<bool> keepAliveResponseRequired = new Atomic<bool>(false);
+ private readonly Atomic<bool> keepAliveResponseRequired = new Atomic<bool>(false);
public bool KeepAliveResponseRequired
{
get { return this.keepAliveResponseRequired.Value; }
@@ -365,9 +365,9 @@ namespace Apache.NMS.ActiveMQ.Transport
// Task that fires when the TaskRunner is signaled by the ReadCheck Timer Task.
class AsyncSignalReadErrorkTask : CompositeTask
{
- private InactivityMonitor parent;
- private Uri remote;
- private Atomic<bool> pending = new Atomic<bool>(false);
+ private readonly InactivityMonitor parent;
+ private readonly Uri remote;
+ private readonly Atomic<bool> pending = new Atomic<bool>(false);
public AsyncSignalReadErrorkTask(InactivityMonitor parent, Uri remote)
{
@@ -396,8 +396,8 @@ namespace Apache.NMS.ActiveMQ.Transport
// Task that fires when the TaskRunner is signaled by the WriteCheck Timer Task.
class AsyncWriteTask : CompositeTask
{
- private InactivityMonitor parent;
- private Atomic<bool> pending = new Atomic<bool>(false);
+ private readonly InactivityMonitor parent;
+ private readonly Atomic<bool> pending = new Atomic<bool>(false);
public AsyncWriteTask(InactivityMonitor parent)
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransport.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Mock/MockTransport.cs Wed Sep 1 19:15:42 2010
@@ -49,7 +49,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
private int numSentKeepAliveInfosBeforeFail = 0;
private int numSentKeppAliveInfos = 0;
private int nextCommandId = 0;
- private Uri connectedUri;
+ private readonly Uri connectedUri;
private CommandHandler commandHandler;
private CommandHandler outgoingCommandHandler;
private ExceptionHandler exceptionHandler;
@@ -57,9 +57,9 @@ namespace Apache.NMS.ActiveMQ.Transport.
private ResumedHandler resumedHandler;
private bool disposed = false;
private bool started = false;
- private TaskRunner asyncResponseTask;
- private Queue<Command> receiveQueue = new Queue<Command>();
- private IResponseBuilder responseBuilder = new OpenWireResponseBuilder();
+ private readonly TaskRunner asyncResponseTask;
+ private readonly Queue<Command> receiveQueue = new Queue<Command>();
+ private readonly IResponseBuilder responseBuilder = new OpenWireResponseBuilder();
#endregion
@@ -67,7 +67,7 @@ namespace Apache.NMS.ActiveMQ.Transport.
private class AsyncResponseTask : Task
{
- private MockTransport parent;
+ private readonly MockTransport parent;
public AsyncResponseTask(MockTransport parent)
{
@@ -280,15 +280,10 @@ namespace Apache.NMS.ActiveMQ.Transport.
public Object Narrow(Type type)
{
- if(this.GetType().Equals(type))
- {
- return this;
- }
-
- return null;
+ return this.GetType().Equals(type) ? this : null;
}
- #region Property Accessors
+ #region Property Accessors
public string Name
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransport.cs Wed Sep 1 19:15:42 2010
@@ -17,7 +17,6 @@
using System;
using System.IO;
-using System.Net;
using System.Net.Sockets;
using System.Net.Security;
using System.Security.Authentication;
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/SslTransportFactory.cs Wed Sep 1 19:15:42 2010
@@ -16,7 +16,6 @@
*/
using System;
-using System.Net;
using System.Net.Sockets;
namespace Apache.NMS.ActiveMQ.Transport.Tcp
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Tcp/TcpTransport.cs Wed Sep 1 19:15:42 2010
@@ -37,9 +37,9 @@ namespace Apache.NMS.ActiveMQ.Transport.
private Thread readThread;
private bool started;
private bool disposed = false;
- private Atomic<bool> closed = new Atomic<bool>(false);
+ private readonly Atomic<bool> closed = new Atomic<bool>(false);
private volatile bool seenShutdown;
- private Uri connectedUri;
+ private readonly Uri connectedUri;
private CommandHandler commandHandler;
private ExceptionHandler exceptionHandler;
@@ -94,9 +94,8 @@ namespace Apache.NMS.ActiveMQ.Transport.
socketReader = new EndianBinaryReader(CreateSocketStream());
// now lets create the background read thread
- readThread = new Thread(new ThreadStart(ReadLoop));
- readThread.IsBackground = true;
- readThread.Start();
+ readThread = new Thread(new ThreadStart(ReadLoop)) {IsBackground = true};
+ readThread.Start();
}
}
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/TransportFactory.cs Wed Sep 1 19:15:42 2010
@@ -68,7 +68,7 @@ namespace Apache.NMS.ActiveMQ.Transport
{
string scheme = location.Scheme;
- if(null == scheme || 0 == scheme.Length)
+ if(string.IsNullOrEmpty(scheme))
{
throw new NMSConnectionException(String.Format("Transport scheme invalid: [{0}]", location.ToString()));
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/WireFormatNegotiator.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/WireFormatNegotiator.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/WireFormatNegotiator.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/WireFormatNegotiator.cs Wed Sep 1 19:15:42 2010
@@ -26,12 +26,12 @@ namespace Apache.NMS.ActiveMQ.Transport
/// </summary>
public class WireFormatNegotiator : TransportFilter
{
- private OpenWireFormat wireFormat;
- private TimeSpan negotiateTimeout = TimeSpan.FromSeconds(15);
+ private readonly OpenWireFormat wireFormat;
+ private readonly TimeSpan negotiateTimeout = TimeSpan.FromSeconds(15);
- private Atomic<bool> firstStart=new Atomic<bool>(true);
- private CountDownLatch readyCountDownLatch = new CountDownLatch(1);
- private CountDownLatch wireInfoSentDownLatch = new CountDownLatch(1);
+ private readonly Atomic<bool> firstStart=new Atomic<bool>(true);
+ private readonly CountDownLatch readyCountDownLatch = new CountDownLatch(1);
+ private readonly CountDownLatch wireInfoSentDownLatch = new CountDownLatch(1);
public WireFormatNegotiator(ITransport next, OpenWireFormat wireFormat)
: base(next)
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/ActiveMQMessageTransformation.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/ActiveMQMessageTransformation.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/ActiveMQMessageTransformation.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/ActiveMQMessageTransformation.cs Wed Sep 1 19:15:42 2010
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-using System;
using Apache.NMS.Util;
using Apache.NMS.ActiveMQ.Commands;
@@ -23,7 +22,7 @@ namespace Apache.NMS.ActiveMQ.Util
{
public class ActiveMQMessageTransformation : MessageTransformation
{
- private Connection connection;
+ private readonly Connection connection;
public ActiveMQMessageTransformation(Connection connection) : base()
{
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FifoMessageDispatchChannel.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FifoMessageDispatchChannel.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FifoMessageDispatchChannel.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/FifoMessageDispatchChannel.cs Wed Sep 1 19:15:42 2010
@@ -30,7 +30,7 @@ namespace Apache.NMS.ActiveMQ.Util
private readonly Mutex mutex = new Mutex();
private bool closed;
private bool running;
- private LinkedList<MessageDispatch> channel = new LinkedList<MessageDispatch>();
+ private readonly LinkedList<MessageDispatch> channel = new LinkedList<MessageDispatch>();
#region Properties
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs Wed Sep 1 19:15:42 2010
@@ -24,10 +24,10 @@ namespace Apache.NMS.ActiveMQ.Util
{
public class IdGenerator
{
- private static String UNIQUE_STUB;
+ private static readonly String UNIQUE_STUB;
private static int instanceCount;
- private static String hostName;
- private String seed;
+ private static readonly String hostName;
+ private readonly String seed;
private long sequence;
static IdGenerator()
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MemoryUsage.cs Wed Sep 1 19:15:42 2010
@@ -16,7 +16,6 @@
*/
using System;
using System.Threading;
-using Apache.NMS;
using Apache.NMS.Util;
namespace Apache.NMS.ActiveMQ.Util
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MessageDispatchChannel.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MessageDispatchChannel.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MessageDispatchChannel.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/MessageDispatchChannel.cs Wed Sep 1 19:15:42 2010
@@ -16,8 +16,6 @@
*/
using System;
-using System.Collections.Generic;
-using System.Threading;
using Apache.NMS.ActiveMQ.Commands;
namespace Apache.NMS.ActiveMQ.Util
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/SimplePriorityMessageDispatchChannel.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/SimplePriorityMessageDispatchChannel.cs?rev=991661&r1=991660&r2=991661&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/SimplePriorityMessageDispatchChannel.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/SimplePriorityMessageDispatchChannel.cs Wed Sep 1 19:15:42 2010
@@ -29,7 +29,7 @@ namespace Apache.NMS.ActiveMQ.Util
private readonly Mutex mutex = new Mutex();
private bool closed;
private bool running;
- private LinkedList<MessageDispatch>[] channels = new LinkedList<MessageDispatch>[MAX_PRIORITY];
+ private readonly LinkedList<MessageDispatch>[] channels = new LinkedList<MessageDispatch>[MAX_PRIORITY];
private int size;
public SimplePriorityMessageDispatchChannel()