You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/10/19 03:34:20 UTC
svn commit: r465441 - in
/incubator/activemq/activemq-dotnet/trunk/src/main/csharp:
ActiveMQ/Commands/ActiveMQMessage.cs ActiveMQ/Connection.cs
ActiveMQ/Transport/Tcp/TcpTransportFactory.cs ActiveMQ/Util/DateUtils.cs
MSMQ/Connection.cs NMS/IMessage.cs
Author: chirino
Date: Wed Oct 18 18:34:16 2006
New Revision: 465441
URL: http://svn.apache.org/viewvc?view=rev&rev=465441
Log:
- The response correlator is a thread safe Transport layer, it should not be protected by the MutexTransport
- Consolidated the Java time to DateTime logic int the DateUtils class
- Clear up the in the NMS doco that message timestamps are in UTC
- Our messages now report the timestamps in UTC
- Protect against a NPE if the ExceptionListener is not set on the connection
Modified:
incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQMessage.cs
incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs
incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs
incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs
incubator/activemq/activemq-dotnet/trunk/src/main/csharp/MSMQ/Connection.cs
incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessage.cs
Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQMessage.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQMessage.cs?view=diff&rev=465441&r1=465440&r2=465441
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQMessage.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Commands/ActiveMQMessage.cs Wed Oct 18 18:34:16 2006
@@ -15,6 +15,7 @@
* limitations under the License.
*/
using ActiveMQ.OpenWire;
+using ActiveMQ.Util;
using NMS;
using System;
@@ -27,10 +28,6 @@
{
public class ActiveMQMessage : Message, IMessage, MarshallAware
{
- // TODO doesn't work on Mono
- private DateTime UNIX_TIME_BASE = new DateTime(1970, 1, 1, 0, 0, 0, 0);
- //private DateTime UNIX_TIME_BASE = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
-
public const byte ID_ActiveMQMessage = 23;
protected static MessagePropertyHelper propertyHelper = new MessagePropertyHelper();
@@ -188,8 +185,7 @@
public DateTime NMSTimestamp
{
get {
- DateTime rc = UNIX_TIME_BASE.AddMilliseconds(Timestamp);
- return rc.ToLocalTime();
+ return DateUtils.ToDateTime(Timestamp);
}
}
Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs?view=diff&rev=465441&r1=465440&r2=465441
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Connection.cs Wed Oct 18 18:34:16 2006
@@ -285,12 +285,13 @@
Tracer.Error("Unknown command: " + command);
}
}
-
+
protected void OnException(ITransport sender, Exception exception)
- {
- Tracer.ErrorFormat("Transport Exception: {0}", exception.ToString());
+ {
+ Tracer.ErrorFormat("Transport Exception: {0}", exception.ToString());
+ if (ExceptionListener != null)
ExceptionListener(exception);
- }
+ }
protected SessionInfo CreateSessionInfo(AcknowledgementMode acknowledgementMode)
{
Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs?view=diff&rev=465441&r1=465440&r2=465441
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Transport/Tcp/TcpTransportFactory.cs Wed Oct 18 18:34:16 2006
@@ -55,8 +55,8 @@
URISupport.SetProperties(tcpTransport.Wireformat.PreferedWireFormatInfo, map, "wireFormat.");
rc = new WireFormatNegotiator(rc, tcpTransport.Wireformat);
- rc = new ResponseCorrelator(rc);
rc = new MutexTransport(rc);
+ rc = new ResponseCorrelator(rc);
return rc;
}
Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs?view=diff&rev=465441&r1=465440&r2=465441
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs Wed Oct 18 18:34:16 2006
@@ -24,11 +24,21 @@
/// The difference between the Windows epoch (1601-01-01 00:00:00)
/// and the Unix epoch (1970-01-01 00:00:00) in milliseconds.
/// </summary>
- const long EPOCH_DIFF = 11644473600000L;
-
- public static long ToJavaTime(DateTime dateTime)
+ public static readonly long EPOCH_DIFF = 11644473600000L;
+
+ /// <summary>
+ /// The start of the UNIX epoch
+ /// </summary>
+ public static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1, 0, 0, 0, 0);
+
+ public static long ToJavaTime(DateTime dateTime)
{
return dateTime.ToFileTime() + EPOCH_DIFF;
}
+
+ public static DateTime ToDateTime(long dateTime)
+ {
+ return UNIX_EPOCH.AddMilliseconds(dateTime);
+ }
}
}
Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/MSMQ/Connection.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/MSMQ/Connection.cs?view=diff&rev=465441&r1=465440&r2=465441
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/MSMQ/Connection.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/MSMQ/Connection.cs Wed Oct 18 18:34:16 2006
@@ -94,7 +94,9 @@
clientId = value;
}
}
-
+
+ public event ExceptionListener ExceptionListener;
+
protected void CheckConnected()
{
if (closed)
Modified: incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessage.cs
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessage.cs?view=diff&rev=465441&r1=465440&r2=465441
==============================================================================
--- incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessage.cs (original)
+++ incubator/activemq/activemq-dotnet/trunk/src/main/csharp/NMS/IMessage.cs Wed Oct 18 18:34:16 2006
@@ -111,7 +111,8 @@
/// <summary>
- /// The timestamp of when the message was pubished.
+ /// The timestamp of when the message was pubished in UTC time. If the publisher disables setting
+ /// the timestamp on the message, the time will be set to the start of the UNIX epoc (1970-01-01 00:00:00).
/// </summary>
DateTime NMSTimestamp
{