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 2013/10/02 20:08:32 UTC
svn commit: r1528583 [1/5] - in
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp: ./
Commands/ OpenWire/ OpenWire/V10/
Author: tabish
Date: Wed Oct 2 18:08:31 2013
New Revision: 1528583
URL: http://svn.apache.org/r1528583
Log:
https://issues.apache.org/jira/browse/AMQNET-444
https://issues.apache.org/jira/browse/AMQNET-443
Added:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBlobMessageMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBytesMessageMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQDestinationMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQMapMessageMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQMessageMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQObjectMessageMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQQueueMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQStreamMessageMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQTempDestinationMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQTempQueueMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQTempTopicMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQTextMessageMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQTopicMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/BaseCommandMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/BrokerIdMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/BrokerInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ConnectionControlMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ConnectionErrorMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ConnectionIdMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ConnectionInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ConsumerControlMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ConsumerIdMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ConsumerInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ControlCommandMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/DataArrayResponseMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/DataResponseMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/DestinationInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/DiscoveryEventMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ExceptionResponseMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/FlushCommandMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/IntegerResponseMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/JournalQueueAckMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/JournalTopicAckMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/JournalTraceMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/JournalTransactionMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/KeepAliveInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/LastPartialCommandMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/LocalTransactionIdMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/MarshallerFactory.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/MessageAckMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/MessageDispatchMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/MessageDispatchNotificationMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/MessageIdMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/MessageMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/MessagePullMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/NetworkBridgeFilterMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/PartialCommandMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ProducerAckMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ProducerIdMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ProducerInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/RemoveInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/RemoveSubscriptionInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ReplayCommandMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ResponseMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/SessionIdMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/SessionInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ShutdownInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/SubscriptionInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/TransactionIdMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/TransactionInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/WireFormatInfoMarshaller.cs (with props)
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/XATransactionIdMarshaller.cs (with props)
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConsumerInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageId.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/NetworkBridgeFilter.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/TransactionInfo.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/XATransactionId.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxTransactionContext.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConsumerInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConsumerInfo.cs?rev=1528583&r1=1528582&r2=1528583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConsumerInfo.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/ConsumerInfo.cs Wed Oct 2 18:08:31 2013
@@ -40,6 +40,7 @@ namespace Apache.NMS.ActiveMQ.Commands
int maximumPendingMessageLimit;
bool dispatchAsync;
string selector;
+ string clientId;
string subscriptionName;
bool noLocal;
bool exclusive;
@@ -81,6 +82,7 @@ namespace Apache.NMS.ActiveMQ.Commands
"MaximumPendingMessageLimit = " + MaximumPendingMessageLimit + ", " +
"DispatchAsync = " + DispatchAsync + ", " +
"Selector = " + Selector + ", " +
+ "ClientId = " + ClientId + ", " +
"SubscriptionName = " + SubscriptionName + ", " +
"NoLocal = " + NoLocal + ", " +
"Exclusive = " + Exclusive + ", " +
@@ -136,6 +138,12 @@ namespace Apache.NMS.ActiveMQ.Commands
set { this.selector = value; }
}
+ public string ClientId
+ {
+ get { return clientId; }
+ set { this.clientId = value; }
+ }
+
public string SubscriptionName
{
get { return subscriptionName; }
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs?rev=1528583&r1=1528582&r2=1528583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/Message.cs Wed Oct 2 18:08:31 2013
@@ -65,6 +65,7 @@ namespace Apache.NMS.ActiveMQ.Commands
BrokerId[] cluster;
long brokerInTime;
long brokerOutTime;
+ bool jMSXGroupFirstForConsumer;
private bool readOnlyMsgProperties;
private bool readOnlyMsgBody;
@@ -142,7 +143,8 @@ namespace Apache.NMS.ActiveMQ.Commands
"Droppable = " + Droppable + ", " +
"Cluster = " + Cluster + ", " +
"BrokerInTime = " + BrokerInTime + ", " +
- "BrokerOutTime = " + BrokerOutTime + " ]";
+ "BrokerOutTime = " + BrokerOutTime + ", " +
+ "JMSXGroupFirstForConsumer = " + JMSXGroupFirstForConsumer + " ]";
}
public virtual int Size()
@@ -351,6 +353,12 @@ namespace Apache.NMS.ActiveMQ.Commands
set { this.brokerOutTime = value; }
}
+ public bool JMSXGroupFirstForConsumer
+ {
+ get { return jMSXGroupFirstForConsumer; }
+ set { this.jMSXGroupFirstForConsumer = value; }
+ }
+
public virtual bool ReadOnlyProperties
{
get { return this.readOnlyMsgProperties; }
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageId.cs?rev=1528583&r1=1528582&r2=1528583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageId.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/MessageId.cs Wed Oct 2 18:08:31 2013
@@ -32,6 +32,7 @@ namespace Apache.NMS.ActiveMQ.Commands
{
public const byte ID_MESSAGEID = 110;
+ string textView;
ProducerId producerId;
long producerSequenceId;
long brokerSequenceId;
@@ -74,7 +75,21 @@ namespace Apache.NMS.ActiveMQ.Commands
{
if(key == null)
{
- key = producerId.ToString() + ":" + producerSequenceId + ":" + brokerSequenceId;
+ if (!String.IsNullOrEmpty(textView))
+ {
+ if (textView.StartsWith("ID:"))
+ {
+ key = textView;
+ }
+ else
+ {
+ key = "ID:" + textView;
+ }
+ }
+ else
+ {
+ key = producerId.ToString() + ":" + producerSequenceId + ":" + brokerSequenceId;
+ }
}
return key;
@@ -97,6 +112,12 @@ namespace Apache.NMS.ActiveMQ.Commands
producerId = new ProducerId(messageKey);
}
+ public string TextView
+ {
+ get { return textView; }
+ set { this.textView = value; }
+ }
+
public ProducerId ProducerId
{
get { return producerId; }
@@ -119,6 +140,7 @@ namespace Apache.NMS.ActiveMQ.Commands
{
int answer = 0;
+ answer = (answer * 37) + HashCode(TextView);
answer = (answer * 37) + HashCode(ProducerId);
answer = (answer * 37) + HashCode(ProducerSequenceId);
answer = (answer * 37) + HashCode(BrokerSequenceId);
@@ -138,6 +160,10 @@ namespace Apache.NMS.ActiveMQ.Commands
public virtual bool Equals(MessageId that)
{
+ if(!Equals(this.TextView, that.TextView))
+ {
+ return false;
+ }
if(!Equals(this.ProducerId, that.ProducerId))
{
return false;
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/NetworkBridgeFilter.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/NetworkBridgeFilter.cs?rev=1528583&r1=1528582&r2=1528583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/NetworkBridgeFilter.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/NetworkBridgeFilter.cs Wed Oct 2 18:08:31 2013
@@ -31,8 +31,9 @@ namespace Apache.NMS.ActiveMQ.Commands
{
public const byte ID_NETWORKBRIDGEFILTER = 91;
- int networkTTL;
BrokerId networkBrokerId;
+ int messageTTL;
+ int consumerTTL;
///
/// <summery>
@@ -54,14 +55,9 @@ namespace Apache.NMS.ActiveMQ.Commands
public override string ToString()
{
return GetType().Name + "[ " +
- "NetworkTTL = " + NetworkTTL + ", " +
- "NetworkBrokerId = " + NetworkBrokerId + " ]";
- }
-
- public int NetworkTTL
- {
- get { return networkTTL; }
- set { this.networkTTL = value; }
+ "NetworkBrokerId = " + NetworkBrokerId + ", " +
+ "MessageTTL = " + MessageTTL + ", " +
+ "ConsumerTTL = " + ConsumerTTL + " ]";
}
public BrokerId NetworkBrokerId
@@ -70,6 +66,18 @@ namespace Apache.NMS.ActiveMQ.Commands
set { this.networkBrokerId = value; }
}
+ public int MessageTTL
+ {
+ get { return messageTTL; }
+ set { this.messageTTL = value; }
+ }
+
+ public int ConsumerTTL
+ {
+ get { return consumerTTL; }
+ set { this.consumerTTL = value; }
+ }
+
};
}
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/TransactionInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/TransactionInfo.cs?rev=1528583&r1=1528582&r2=1528583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/TransactionInfo.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/TransactionInfo.cs Wed Oct 2 18:08:31 2013
@@ -105,7 +105,7 @@ namespace Apache.NMS.ActiveMQ.Commands
/// <summery>
/// Allows a Visitor to visit this command and return a response to the
/// command based on the command type being visited. The command will call
- /// the proper ProcessXXX method in the visitor.
+ /// the proper processXXX method in the visitor.
/// </summery>
///
public override Response Visit(ICommandVisitor visitor)
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/XATransactionId.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/XATransactionId.cs?rev=1528583&r1=1528582&r2=1528583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/XATransactionId.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Commands/XATransactionId.cs Wed Oct 2 18:08:31 2013
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+using System;
namespace Apache.NMS.ActiveMQ.Commands
{
@@ -54,10 +55,10 @@ namespace Apache.NMS.ActiveMQ.Commands
///
public override string ToString()
{
- return GetType().Name + "[ " +
- "FormatId = " + FormatId + ", " +
- "GlobalTransactionId = " + GlobalTransactionId ?? System.Text.ASCIIEncoding.ASCII.GetString(GlobalTransactionId) + ", " +
- "BranchQualifier = " + BranchQualifier ?? System.Text.ASCIIEncoding.ASCII.GetString(BranchQualifier) + " ]";
+ return GetType().Name + "[ " +
+ "FormatId = " + FormatId + ", " +
+ "GlobalTransactionId = " + BitConverter.ToString(GlobalTransactionId).Replace("-", string.Empty) + ", " +
+ "BranchQualifier = " + System.Text.ASCIIEncoding.ASCII.GetString(BranchQualifier) + " ]";
}
public int FormatId
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=1528583&r1=1528582&r2=1528583&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 Oct 2 18:08:31 2013
@@ -139,6 +139,7 @@ namespace Apache.NMS.ActiveMQ
this.info.Retroactive = session.Retroactive;
this.info.Exclusive = session.Exclusive;
this.info.Priority = session.Priority;
+ this.info.ClientId = session.Connection.ClientId;
// If the destination contained a URI query, then use it to set public properties
// on the ConsumerInfo
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxTransactionContext.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxTransactionContext.cs?rev=1528583&r1=1528582&r2=1528583&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxTransactionContext.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/NetTxTransactionContext.cs Wed Oct 2 18:08:31 2013
@@ -1,611 +1,611 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using System.Transactions;
-using Apache.NMS.ActiveMQ.Commands;
-using Apache.NMS.ActiveMQ.Transactions;
-using Apache.NMS.Util;
-
-namespace Apache.NMS.ActiveMQ
-{
- public sealed class NetTxTransactionContext : TransactionContext, ISinglePhaseNotification
- {
- private const int XA_OK = 0;
- private const int XA_READONLY = 3;
-
- private Enlistment currentEnlistment;
-
- public NetTxTransactionContext(Session session) : base(session)
- {
- }
-
- public override bool InLocalTransaction
- {
- get { return this.transactionId != null && this.currentEnlistment == null; }
- }
-
- public override void Begin()
- {
- throw new IllegalStateException("Local Transactions not supported in NetTx resources");
- }
-
- public override void Commit()
- {
- throw new IllegalStateException("Local Transactions not supported in NetTx resources");
- }
-
- public override void Rollback()
- {
- throw new IllegalStateException("Local Transactions not supported in NetTx resources");
- }
-
- #region Transaction Members used when dealing with .NET System Transactions.
-
- // When DTC calls prepare we must then wait for either the TX to commit, rollback or
- // be canceled because its in doubt.
- private readonly ManualResetEvent dtcControlEvent = new ManualResetEvent(true);
-
- // Once the DTC calls prepare we lock this object and don't unlock it again until
- // the TX has either completed or terminated, the users of this class should use
- // this sync point when the TX is a DTC version as opposed to a local one.
- private readonly object syncObject = new Mutex();
-
- public enum TxState
- {
- None = 0, Active = 1, Pending = 2
- }
-
- private TxState netTxState = TxState.None;
-
- public object SyncRoot
- {
- get { return this.syncObject; }
- }
-
- public bool InNetTransaction
- {
- get { return this.transactionId != null && this.transactionId is XATransactionId; }
- }
-
- public TxState NetTxState
- {
- get
- {
- return this.netTxState;
- }
- }
-
- public WaitHandle DtcWaitHandle
- {
- get { return dtcControlEvent; }
- }
-
- public void Begin(Transaction transaction)
- {
- lock (syncObject)
- {
- dtcControlEvent.Reset();
-
- Tracer.Debug("Begin notification received");
-
- if (InNetTransaction)
- {
- throw new TransactionInProgressException("A Transaction is already in Progress");
- }
-
- try
- {
- Guid rmId = ResourceManagerGuid;
-
- // Enlist this object in the transaction.
- this.currentEnlistment =
- transaction.EnlistDurable(rmId, this, EnlistmentOptions.None);
-
- // In case of a exception in the current method the transaction will be rolled back.
- // Until Begin Transaction is completed we consider to be in a rollback scenario.
- this.netTxState = TxState.Pending;
-
- Tracer.Debug("Enlisted in Durable Transaction with RM Id: " + rmId);
-
- TransactionInformation txInfo = transaction.TransactionInformation;
-
- XATransactionId xaId = new XATransactionId();
- this.transactionId = xaId;
-
- if (txInfo.DistributedIdentifier != Guid.Empty)
- {
- xaId.GlobalTransactionId = txInfo.DistributedIdentifier.ToByteArray();
- xaId.BranchQualifier = Encoding.UTF8.GetBytes(Guid.NewGuid().ToString());
- }
- else
- {
- xaId.GlobalTransactionId = Encoding.UTF8.GetBytes(txInfo.LocalIdentifier);
- xaId.BranchQualifier = Encoding.UTF8.GetBytes(Guid.NewGuid().ToString());
- }
-
- // Now notify the broker that a new XA'ish transaction has started.
- TransactionInfo info = new TransactionInfo();
- info.ConnectionId = this.connection.ConnectionId;
- info.TransactionId = this.transactionId;
- info.Type = (int)TransactionType.Begin;
-
- this.session.Connection.Oneway(info);
-
- // Begin Transaction is completed successfully. Change to transaction active state now.
- this.netTxState = TxState.Active;
-
- SignalTransactionStarted();
-
- if (Tracer.IsDebugEnabled)
- {
- Tracer.Debug("Began XA'ish Transaction:" + xaId.GlobalTransactionId);
- }
- }
- catch (Exception)
- {
- // When in pending state the rollback will signal that a new transaction can be started. Otherwise do it here.
- if (netTxState != TxState.Pending)
- {
- netTxState = TxState.None;
- dtcControlEvent.Set();
- }
- throw;
- }
- }
- }
-
- public void Prepare(PreparingEnlistment preparingEnlistment)
- {
- lock (this.syncObject)
- {
- this.netTxState = TxState.Pending;
-
- try
- {
- Tracer.Debug("Prepare notification received for TX id: " + this.transactionId);
-
- BeforeEnd();
-
- // Before sending the request to the broker, log the recovery bits, if
- // this fails we can't prepare and the TX should be rolled back.
- RecoveryLogger.LogRecoveryInfo(this.transactionId as XATransactionId,
- preparingEnlistment.RecoveryInformation());
-
- // Inform the broker that work on the XA'sh TX Branch is complete.
- TransactionInfo info = new TransactionInfo();
- info.ConnectionId = this.connection.ConnectionId;
- info.TransactionId = this.transactionId;
- info.Type = (int)TransactionType.End;
-
- this.connection.CheckConnected();
- this.connection.SyncRequest(info);
-
- // Prepare the Transaction for commit.
- info.Type = (int)TransactionType.Prepare;
- IntegerResponse response = (IntegerResponse)this.connection.SyncRequest(info);
- if (response.Result == XA_READONLY)
- {
- Tracer.Debug("Transaction Prepare done and doesn't need a commit, TX id: " + this.transactionId);
-
- this.transactionId = null;
- this.currentEnlistment = null;
-
- // Read Only means there's nothing to recover because there was no
- // change on the broker.
- RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
-
- // if server responds that nothing needs to be done, then reply done.
- // otherwise the DTC will call Commit or Rollback but another transaction
- // can already be in progress and this one would be commited or rolled back
- // immediately.
- preparingEnlistment.Done();
-
- // Done so commit won't be called.
- AfterCommit();
-
- // A Read-Only TX is considered closed at this point, DTC won't call us again.
- this.dtcControlEvent.Set();
- }
- else
- {
- Tracer.Debug("Transaction Prepare succeeded TX id: " + this.transactionId);
-
- // If work finished correctly, reply prepared
- preparingEnlistment.Prepared();
- }
- }
- catch (Exception ex)
- {
- Tracer.DebugFormat("Transaction[{0}] Prepare failed with error: {1}",
- this.transactionId, ex.Message);
-
- AfterRollback();
- preparingEnlistment.ForceRollback();
- try
- {
- this.connection.OnException(ex);
- }
- catch (Exception error)
- {
- Tracer.Error(error.ToString());
- }
-
- this.currentEnlistment = null;
- this.transactionId = null;
- this.netTxState = TxState.None;
- this.dtcControlEvent.Set();
- }
- }
- }
-
- public void Commit(Enlistment enlistment)
- {
- lock (this.syncObject)
- {
- try
- {
- Tracer.Debug("Commit notification received for TX id: " + this.transactionId);
-
- if (this.transactionId != null)
- {
- // Now notify the broker that a new XA'ish transaction has completed.
- TransactionInfo info = new TransactionInfo();
- info.ConnectionId = this.connection.ConnectionId;
- info.TransactionId = this.transactionId;
- info.Type = (int)TransactionType.CommitTwoPhase;
-
- this.connection.CheckConnected();
- this.connection.SyncRequest(info);
-
- Tracer.Debug("Transaction Commit Done TX id: " + this.transactionId);
-
- RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
-
- // if server responds that nothing needs to be done, then reply done.
- enlistment.Done();
-
- AfterCommit();
- }
- }
- catch (Exception ex)
- {
- Tracer.DebugFormat("Transaction[{0}] Commit failed with error: {1}",
- this.transactionId, ex.Message);
- try
- {
- this.connection.OnException(ex);
- }
- catch (Exception error)
- {
- Tracer.Error(error.ToString());
- }
- }
- finally
- {
- this.currentEnlistment = null;
- this.transactionId = null;
- this.netTxState = TxState.None;
-
- CountDownLatch latch = this.recoveryComplete;
- if (latch != null)
- {
- latch.countDown();
- }
-
- this.dtcControlEvent.Set();
- }
- }
- }
-
- public void SinglePhaseCommit(SinglePhaseEnlistment enlistment)
- {
- lock (this.syncObject)
- {
- try
- {
- Tracer.Debug("Single Phase Commit notification received for TX id: " + this.transactionId);
-
- if (this.transactionId != null)
- {
- BeforeEnd();
-
- // Now notify the broker that a new XA'ish transaction has completed.
- TransactionInfo info = new TransactionInfo();
- info.ConnectionId = this.connection.ConnectionId;
- info.TransactionId = this.transactionId;
- info.Type = (int)TransactionType.CommitOnePhase;
-
- this.connection.CheckConnected();
- this.connection.SyncRequest(info);
-
- Tracer.Debug("Transaction Single Phase Commit Done TX id: " + this.transactionId);
-
- // if server responds that nothing needs to be done, then reply done.
- enlistment.Done();
-
- AfterCommit();
- }
- }
- catch (Exception ex)
- {
- Tracer.DebugFormat("Transaction[{0}] Single Phase Commit failed with error: {1}",
- this.transactionId, ex.Message);
- AfterRollback();
- enlistment.Done();
- try
- {
- this.connection.OnException(ex);
- }
- catch (Exception error)
- {
- Tracer.Error(error.ToString());
- }
- }
- finally
- {
- this.currentEnlistment = null;
- this.transactionId = null;
- this.netTxState = TxState.None;
-
- this.dtcControlEvent.Set();
- }
- }
- }
-
- public void Rollback(Enlistment enlistment)
- {
- lock (this.syncObject)
- {
- try
- {
- Tracer.Debug("Rollback notification received for TX id: " + this.transactionId);
-
- if (this.transactionId != null)
- {
- BeforeEnd();
-
- // Now notify the broker that a new XA'ish transaction has started.
- TransactionInfo info = new TransactionInfo();
- info.ConnectionId = this.connection.ConnectionId;
- info.TransactionId = this.transactionId;
- info.Type = (int)TransactionType.End;
-
- this.connection.CheckConnected();
- this.connection.SyncRequest(info);
-
- info.Type = (int)TransactionType.Rollback;
- this.connection.CheckConnected();
- this.connection.SyncRequest(info);
-
- Tracer.Debug("Transaction Rollback Done TX id: " + this.transactionId);
-
- RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
-
- // if server responds that nothing needs to be done, then reply done.
- enlistment.Done();
-
- AfterRollback();
- }
- }
- catch (Exception ex)
- {
- Tracer.DebugFormat("Transaction[{0}] Rollback failed with error: {1}",
- this.transactionId, ex.Message);
- AfterRollback();
- try
- {
- this.connection.OnException(ex);
- }
- catch (Exception error)
- {
- Tracer.Error(error.ToString());
- }
- }
- finally
- {
- this.currentEnlistment = null;
- this.transactionId = null;
- this.netTxState = TxState.None;
-
- CountDownLatch latch = this.recoveryComplete;
- if (latch != null)
- {
- latch.countDown();
- }
-
- this.dtcControlEvent.Set();
- }
- }
- }
-
- public void InDoubt(Enlistment enlistment)
- {
- lock (syncObject)
- {
- try
- {
- Tracer.Debug("In Doubt notification received for TX id: " + this.transactionId);
-
- BeforeEnd();
-
- // Now notify the broker that Rollback should be performed.
- TransactionInfo info = new TransactionInfo();
- info.ConnectionId = this.connection.ConnectionId;
- info.TransactionId = this.transactionId;
- info.Type = (int)TransactionType.End;
-
- this.connection.CheckConnected();
- this.connection.SyncRequest(info);
-
- info.Type = (int)TransactionType.Rollback;
- this.connection.CheckConnected();
- this.connection.SyncRequest(info);
-
- Tracer.Debug("InDoubt Transaction Rollback Done TX id: " + this.transactionId);
-
- RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
-
- // if server responds that nothing needs to be done, then reply done.
- enlistment.Done();
-
- AfterRollback();
- }
- finally
- {
- this.currentEnlistment = null;
- this.transactionId = null;
- this.netTxState = TxState.None;
-
- CountDownLatch latch = this.recoveryComplete;
- if (latch != null)
- {
- latch.countDown();
- }
-
- this.dtcControlEvent.Set();
- }
- }
- }
-
- #endregion
-
- #region Distributed Transaction Recovery Bits
-
- private volatile CountDownLatch recoveryComplete;
-
- /// <summary>
- /// Should be called from NetTxSession when created to check if any TX
- /// data is stored for recovery and whether the Broker has matching info
- /// stored. If an Transaction is found that belongs to this client and is
- /// still alive on the Broker it will be recovered, otherwise the stored
- /// data should be cleared.
- /// </summary>
- public void InitializeDtcTxContext()
- {
- // initialize the logger with the current Resource Manager Id
- RecoveryLogger.Initialize(ResourceManagerId);
-
- KeyValuePair<XATransactionId, byte[]>[] localRecoverables = RecoveryLogger.GetRecoverables();
- if (localRecoverables.Length == 0)
- {
- Tracer.Debug("Did not detect any open DTC transaction records on disk.");
- // No local data so anything stored on the broker can't be recovered here.
- return;
- }
-
- XATransactionId[] recoverables = TryRecoverBrokerTXIds();
- if (recoverables.Length == 0)
- {
- Tracer.Debug("Did not detect any recoverable transactions at Broker.");
- // Broker has no recoverable data so nothing to do here, delete the
- // old recovery log as its stale.
- RecoveryLogger.Purge();
- return;
- }
-
- List<KeyValuePair<XATransactionId, byte[]>> matches = new List<KeyValuePair<XATransactionId, byte[]>>();
-
- foreach (XATransactionId recoverable in recoverables)
- {
- foreach (KeyValuePair<XATransactionId, byte[]> entry in localRecoverables)
- {
- if (entry.Key.Equals(recoverable))
- {
- Tracer.DebugFormat("Found a matching TX on Broker to stored Id: {0} reenlisting.", entry.Key);
- matches.Add(entry);
- }
- }
- }
-
- if (matches.Count != 0)
- {
- this.recoveryComplete = new CountDownLatch(matches.Count);
-
- foreach (KeyValuePair<XATransactionId, byte[]> recoverable in matches)
- {
- this.transactionId = recoverable.Key;
- Tracer.Info("Reenlisting recovered TX with Id: " + this.transactionId);
- this.currentEnlistment =
- TransactionManager.Reenlist(ResourceManagerGuid, recoverable.Value, this);
- }
-
- this.recoveryComplete.await();
- Tracer.Debug("All Recovered TX enlistments Reports complete, Recovery Complete.");
- TransactionManager.RecoveryComplete(ResourceManagerGuid);
- return;
- }
-
- // The old recovery information doesn't match what's on the broker so we
- // should discard it as its stale now.
- RecoveryLogger.Purge();
- }
-
- private XATransactionId[] TryRecoverBrokerTXIds()
- {
- Tracer.Debug("Checking for Recoverable Transactions on Broker.");
-
- TransactionInfo info = new TransactionInfo();
- info.ConnectionId = this.session.Connection.ConnectionId;
- info.Type = (int)TransactionType.Recover;
-
- this.connection.CheckConnected();
- DataArrayResponse response = this.connection.SyncRequest(info) as DataArrayResponse;
-
- if (response != null && response.Data.Length > 0)
- {
- Tracer.DebugFormat("Broker reports there are {0} recoverable XA Transactions", response.Data.Length);
-
- List<XATransactionId> recovered = new List<XATransactionId>();
-
- foreach (DataStructure ds in response.Data)
- {
- XATransactionId xid = ds as XATransactionId;
- if (xid != null)
- {
- recovered.Add(xid);
- }
- }
-
- return recovered.ToArray();
- }
-
- return new XATransactionId[0];
- }
-
- #endregion
-
- internal IRecoveryLogger RecoveryLogger
- {
- get { return (this.connection as NetTxConnection).RecoveryPolicy.RecoveryLogger; }
- }
-
- internal string ResourceManagerId
- {
- get { return (this.connection as NetTxConnection).ResourceManagerGuid.ToString(); }
- }
-
- internal Guid ResourceManagerGuid
- {
- get { return (this.connection as NetTxConnection).ResourceManagerGuid; }
- }
-
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading;
+using System.Transactions;
+using Apache.NMS.ActiveMQ.Commands;
+using Apache.NMS.ActiveMQ.Transactions;
+using Apache.NMS.Util;
+
+namespace Apache.NMS.ActiveMQ
+{
+ public sealed class NetTxTransactionContext : TransactionContext, ISinglePhaseNotification
+ {
+ private const int XA_OK = 0;
+ private const int XA_READONLY = 3;
+
+ private Enlistment currentEnlistment;
+
+ public NetTxTransactionContext(Session session) : base(session)
+ {
+ }
+
+ public override bool InLocalTransaction
+ {
+ get { return this.transactionId != null && this.currentEnlistment == null; }
+ }
+
+ public override void Begin()
+ {
+ throw new IllegalStateException("Local Transactions not supported in NetTx resources");
+ }
+
+ public override void Commit()
+ {
+ throw new IllegalStateException("Local Transactions not supported in NetTx resources");
+ }
+
+ public override void Rollback()
+ {
+ throw new IllegalStateException("Local Transactions not supported in NetTx resources");
+ }
+
+ #region Transaction Members used when dealing with .NET System Transactions.
+
+ // When DTC calls prepare we must then wait for either the TX to commit, rollback or
+ // be canceled because its in doubt.
+ private readonly ManualResetEvent dtcControlEvent = new ManualResetEvent(true);
+
+ // Once the DTC calls prepare we lock this object and don't unlock it again until
+ // the TX has either completed or terminated, the users of this class should use
+ // this sync point when the TX is a DTC version as opposed to a local one.
+ private readonly object syncObject = new Mutex();
+
+ public enum TxState
+ {
+ None = 0, Active = 1, Pending = 2
+ }
+
+ private TxState netTxState = TxState.None;
+
+ public object SyncRoot
+ {
+ get { return this.syncObject; }
+ }
+
+ public bool InNetTransaction
+ {
+ get { return this.transactionId != null && this.transactionId is XATransactionId; }
+ }
+
+ public TxState NetTxState
+ {
+ get
+ {
+ return this.netTxState;
+ }
+ }
+
+ public WaitHandle DtcWaitHandle
+ {
+ get { return dtcControlEvent; }
+ }
+
+ public void Begin(Transaction transaction)
+ {
+ lock (syncObject)
+ {
+ dtcControlEvent.Reset();
+
+ Tracer.Debug("Begin notification received");
+
+ if (InNetTransaction)
+ {
+ throw new TransactionInProgressException("A Transaction is already in Progress");
+ }
+
+ try
+ {
+ Guid rmId = ResourceManagerGuid;
+
+ // Enlist this object in the transaction.
+ this.currentEnlistment =
+ transaction.EnlistDurable(rmId, this, EnlistmentOptions.None);
+
+ // In case of a exception in the current method the transaction will be rolled back.
+ // Until Begin Transaction is completed we consider to be in a rollback scenario.
+ this.netTxState = TxState.Pending;
+
+ Tracer.Debug("Enlisted in Durable Transaction with RM Id: " + rmId);
+
+ TransactionInformation txInfo = transaction.TransactionInformation;
+
+ XATransactionId xaId = new XATransactionId();
+ this.transactionId = xaId;
+
+ if (txInfo.DistributedIdentifier != Guid.Empty)
+ {
+ xaId.GlobalTransactionId = txInfo.DistributedIdentifier.ToByteArray();
+ xaId.BranchQualifier = Encoding.UTF8.GetBytes(Guid.NewGuid().ToString());
+ }
+ else
+ {
+ xaId.GlobalTransactionId = Encoding.UTF8.GetBytes(txInfo.LocalIdentifier);
+ xaId.BranchQualifier = Encoding.UTF8.GetBytes(Guid.NewGuid().ToString());
+ }
+
+ // Now notify the broker that a new XA'ish transaction has started.
+ TransactionInfo info = new TransactionInfo();
+ info.ConnectionId = this.connection.ConnectionId;
+ info.TransactionId = this.transactionId;
+ info.Type = (int)TransactionType.Begin;
+
+ this.session.Connection.Oneway(info);
+
+ // Begin Transaction is completed successfully. Change to transaction active state now.
+ this.netTxState = TxState.Active;
+
+ SignalTransactionStarted();
+
+ if (Tracer.IsDebugEnabled)
+ {
+ Tracer.Debug("Began XA'ish Transaction:" + xaId);
+ }
+ }
+ catch (Exception)
+ {
+ // When in pending state the rollback will signal that a new transaction can be started. Otherwise do it here.
+ if (netTxState != TxState.Pending)
+ {
+ netTxState = TxState.None;
+ dtcControlEvent.Set();
+ }
+ throw;
+ }
+ }
+ }
+
+ public void Prepare(PreparingEnlistment preparingEnlistment)
+ {
+ lock (this.syncObject)
+ {
+ this.netTxState = TxState.Pending;
+
+ try
+ {
+ Tracer.Debug("Prepare notification received for TX id: " + this.transactionId);
+
+ BeforeEnd();
+
+ // Before sending the request to the broker, log the recovery bits, if
+ // this fails we can't prepare and the TX should be rolled back.
+ RecoveryLogger.LogRecoveryInfo(this.transactionId as XATransactionId,
+ preparingEnlistment.RecoveryInformation());
+
+ // Inform the broker that work on the XA'sh TX Branch is complete.
+ TransactionInfo info = new TransactionInfo();
+ info.ConnectionId = this.connection.ConnectionId;
+ info.TransactionId = this.transactionId;
+ info.Type = (int)TransactionType.End;
+
+ this.connection.CheckConnected();
+ this.connection.SyncRequest(info);
+
+ // Prepare the Transaction for commit.
+ info.Type = (int)TransactionType.Prepare;
+ IntegerResponse response = (IntegerResponse)this.connection.SyncRequest(info);
+ if (response.Result == XA_READONLY)
+ {
+ Tracer.Debug("Transaction Prepare done and doesn't need a commit, TX id: " + this.transactionId);
+
+ this.transactionId = null;
+ this.currentEnlistment = null;
+
+ // Read Only means there's nothing to recover because there was no
+ // change on the broker.
+ RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
+
+ // if server responds that nothing needs to be done, then reply done.
+ // otherwise the DTC will call Commit or Rollback but another transaction
+ // can already be in progress and this one would be commited or rolled back
+ // immediately.
+ preparingEnlistment.Done();
+
+ // Done so commit won't be called.
+ AfterCommit();
+
+ // A Read-Only TX is considered closed at this point, DTC won't call us again.
+ this.dtcControlEvent.Set();
+ }
+ else
+ {
+ Tracer.Debug("Transaction Prepare succeeded TX id: " + this.transactionId);
+
+ // If work finished correctly, reply prepared
+ preparingEnlistment.Prepared();
+ }
+ }
+ catch (Exception ex)
+ {
+ Tracer.DebugFormat("Transaction[{0}] Prepare failed with error: {1}",
+ this.transactionId, ex.Message);
+
+ AfterRollback();
+ preparingEnlistment.ForceRollback();
+ try
+ {
+ this.connection.OnException(ex);
+ }
+ catch (Exception error)
+ {
+ Tracer.Error(error.ToString());
+ }
+
+ this.currentEnlistment = null;
+ this.transactionId = null;
+ this.netTxState = TxState.None;
+ this.dtcControlEvent.Set();
+ }
+ }
+ }
+
+ public void Commit(Enlistment enlistment)
+ {
+ lock (this.syncObject)
+ {
+ try
+ {
+ Tracer.Debug("Commit notification received for TX id: " + this.transactionId);
+
+ if (this.transactionId != null)
+ {
+ // Now notify the broker that a new XA'ish transaction has completed.
+ TransactionInfo info = new TransactionInfo();
+ info.ConnectionId = this.connection.ConnectionId;
+ info.TransactionId = this.transactionId;
+ info.Type = (int)TransactionType.CommitTwoPhase;
+
+ this.connection.CheckConnected();
+ this.connection.SyncRequest(info);
+
+ Tracer.Debug("Transaction Commit Done TX id: " + this.transactionId);
+
+ RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
+
+ // if server responds that nothing needs to be done, then reply done.
+ enlistment.Done();
+
+ AfterCommit();
+ }
+ }
+ catch (Exception ex)
+ {
+ Tracer.DebugFormat("Transaction[{0}] Commit failed with error: {1}",
+ this.transactionId, ex.Message);
+ try
+ {
+ this.connection.OnException(ex);
+ }
+ catch (Exception error)
+ {
+ Tracer.Error(error.ToString());
+ }
+ }
+ finally
+ {
+ this.currentEnlistment = null;
+ this.transactionId = null;
+ this.netTxState = TxState.None;
+
+ CountDownLatch latch = this.recoveryComplete;
+ if (latch != null)
+ {
+ latch.countDown();
+ }
+
+ this.dtcControlEvent.Set();
+ }
+ }
+ }
+
+ public void SinglePhaseCommit(SinglePhaseEnlistment enlistment)
+ {
+ lock (this.syncObject)
+ {
+ try
+ {
+ Tracer.Debug("Single Phase Commit notification received for TX id: " + this.transactionId);
+
+ if (this.transactionId != null)
+ {
+ BeforeEnd();
+
+ // Now notify the broker that a new XA'ish transaction has completed.
+ TransactionInfo info = new TransactionInfo();
+ info.ConnectionId = this.connection.ConnectionId;
+ info.TransactionId = this.transactionId;
+ info.Type = (int)TransactionType.CommitOnePhase;
+
+ this.connection.CheckConnected();
+ this.connection.SyncRequest(info);
+
+ Tracer.Debug("Transaction Single Phase Commit Done TX id: " + this.transactionId);
+
+ // if server responds that nothing needs to be done, then reply done.
+ enlistment.Done();
+
+ AfterCommit();
+ }
+ }
+ catch (Exception ex)
+ {
+ Tracer.DebugFormat("Transaction[{0}] Single Phase Commit failed with error: {1}",
+ this.transactionId, ex.Message);
+ AfterRollback();
+ enlistment.Done();
+ try
+ {
+ this.connection.OnException(ex);
+ }
+ catch (Exception error)
+ {
+ Tracer.Error(error.ToString());
+ }
+ }
+ finally
+ {
+ this.currentEnlistment = null;
+ this.transactionId = null;
+ this.netTxState = TxState.None;
+
+ this.dtcControlEvent.Set();
+ }
+ }
+ }
+
+ public void Rollback(Enlistment enlistment)
+ {
+ lock (this.syncObject)
+ {
+ try
+ {
+ Tracer.Debug("Rollback notification received for TX id: " + this.transactionId);
+
+ if (this.transactionId != null)
+ {
+ BeforeEnd();
+
+ // Now notify the broker that a new XA'ish transaction has started.
+ TransactionInfo info = new TransactionInfo();
+ info.ConnectionId = this.connection.ConnectionId;
+ info.TransactionId = this.transactionId;
+ info.Type = (int)TransactionType.End;
+
+ this.connection.CheckConnected();
+ this.connection.SyncRequest(info);
+
+ info.Type = (int)TransactionType.Rollback;
+ this.connection.CheckConnected();
+ this.connection.SyncRequest(info);
+
+ Tracer.Debug("Transaction Rollback Done TX id: " + this.transactionId);
+
+ RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
+
+ // if server responds that nothing needs to be done, then reply done.
+ enlistment.Done();
+
+ AfterRollback();
+ }
+ }
+ catch (Exception ex)
+ {
+ Tracer.DebugFormat("Transaction[{0}] Rollback failed with error: {1}",
+ this.transactionId, ex.Message);
+ AfterRollback();
+ try
+ {
+ this.connection.OnException(ex);
+ }
+ catch (Exception error)
+ {
+ Tracer.Error(error.ToString());
+ }
+ }
+ finally
+ {
+ this.currentEnlistment = null;
+ this.transactionId = null;
+ this.netTxState = TxState.None;
+
+ CountDownLatch latch = this.recoveryComplete;
+ if (latch != null)
+ {
+ latch.countDown();
+ }
+
+ this.dtcControlEvent.Set();
+ }
+ }
+ }
+
+ public void InDoubt(Enlistment enlistment)
+ {
+ lock (syncObject)
+ {
+ try
+ {
+ Tracer.Debug("In Doubt notification received for TX id: " + this.transactionId);
+
+ BeforeEnd();
+
+ // Now notify the broker that Rollback should be performed.
+ TransactionInfo info = new TransactionInfo();
+ info.ConnectionId = this.connection.ConnectionId;
+ info.TransactionId = this.transactionId;
+ info.Type = (int)TransactionType.End;
+
+ this.connection.CheckConnected();
+ this.connection.SyncRequest(info);
+
+ info.Type = (int)TransactionType.Rollback;
+ this.connection.CheckConnected();
+ this.connection.SyncRequest(info);
+
+ Tracer.Debug("InDoubt Transaction Rollback Done TX id: " + this.transactionId);
+
+ RecoveryLogger.LogRecovered(this.transactionId as XATransactionId);
+
+ // if server responds that nothing needs to be done, then reply done.
+ enlistment.Done();
+
+ AfterRollback();
+ }
+ finally
+ {
+ this.currentEnlistment = null;
+ this.transactionId = null;
+ this.netTxState = TxState.None;
+
+ CountDownLatch latch = this.recoveryComplete;
+ if (latch != null)
+ {
+ latch.countDown();
+ }
+
+ this.dtcControlEvent.Set();
+ }
+ }
+ }
+
+ #endregion
+
+ #region Distributed Transaction Recovery Bits
+
+ private volatile CountDownLatch recoveryComplete;
+
+ /// <summary>
+ /// Should be called from NetTxSession when created to check if any TX
+ /// data is stored for recovery and whether the Broker has matching info
+ /// stored. If an Transaction is found that belongs to this client and is
+ /// still alive on the Broker it will be recovered, otherwise the stored
+ /// data should be cleared.
+ /// </summary>
+ public void InitializeDtcTxContext()
+ {
+ // initialize the logger with the current Resource Manager Id
+ RecoveryLogger.Initialize(ResourceManagerId);
+
+ KeyValuePair<XATransactionId, byte[]>[] localRecoverables = RecoveryLogger.GetRecoverables();
+ if (localRecoverables.Length == 0)
+ {
+ Tracer.Debug("Did not detect any open DTC transaction records on disk.");
+ // No local data so anything stored on the broker can't be recovered here.
+ return;
+ }
+
+ XATransactionId[] recoverables = TryRecoverBrokerTXIds();
+ if (recoverables.Length == 0)
+ {
+ Tracer.Debug("Did not detect any recoverable transactions at Broker.");
+ // Broker has no recoverable data so nothing to do here, delete the
+ // old recovery log as its stale.
+ RecoveryLogger.Purge();
+ return;
+ }
+
+ List<KeyValuePair<XATransactionId, byte[]>> matches = new List<KeyValuePair<XATransactionId, byte[]>>();
+
+ foreach (XATransactionId recoverable in recoverables)
+ {
+ foreach (KeyValuePair<XATransactionId, byte[]> entry in localRecoverables)
+ {
+ if (entry.Key.Equals(recoverable))
+ {
+ Tracer.DebugFormat("Found a matching TX on Broker to stored Id: {0} reenlisting.", entry.Key);
+ matches.Add(entry);
+ }
+ }
+ }
+
+ if (matches.Count != 0)
+ {
+ this.recoveryComplete = new CountDownLatch(matches.Count);
+
+ foreach (KeyValuePair<XATransactionId, byte[]> recoverable in matches)
+ {
+ this.transactionId = recoverable.Key;
+ Tracer.Info("Reenlisting recovered TX with Id: " + this.transactionId);
+ this.currentEnlistment =
+ TransactionManager.Reenlist(ResourceManagerGuid, recoverable.Value, this);
+ }
+
+ this.recoveryComplete.await();
+ Tracer.Debug("All Recovered TX enlistments Reports complete, Recovery Complete.");
+ TransactionManager.RecoveryComplete(ResourceManagerGuid);
+ return;
+ }
+
+ // The old recovery information doesn't match what's on the broker so we
+ // should discard it as its stale now.
+ RecoveryLogger.Purge();
+ }
+
+ private XATransactionId[] TryRecoverBrokerTXIds()
+ {
+ Tracer.Debug("Checking for Recoverable Transactions on Broker.");
+
+ TransactionInfo info = new TransactionInfo();
+ info.ConnectionId = this.session.Connection.ConnectionId;
+ info.Type = (int)TransactionType.Recover;
+
+ this.connection.CheckConnected();
+ DataArrayResponse response = this.connection.SyncRequest(info) as DataArrayResponse;
+
+ if (response != null && response.Data.Length > 0)
+ {
+ Tracer.DebugFormat("Broker reports there are {0} recoverable XA Transactions", response.Data.Length);
+
+ List<XATransactionId> recovered = new List<XATransactionId>();
+
+ foreach (DataStructure ds in response.Data)
+ {
+ XATransactionId xid = ds as XATransactionId;
+ if (xid != null)
+ {
+ recovered.Add(xid);
+ }
+ }
+
+ return recovered.ToArray();
+ }
+
+ return new XATransactionId[0];
+ }
+
+ #endregion
+
+ internal IRecoveryLogger RecoveryLogger
+ {
+ get { return (this.connection as NetTxConnection).RecoveryPolicy.RecoveryLogger; }
+ }
+
+ internal string ResourceManagerId
+ {
+ get { return (this.connection as NetTxConnection).ResourceManagerGuid.ToString(); }
+ }
+
+ internal Guid ResourceManagerGuid
+ {
+ get { return (this.connection as NetTxConnection).ResourceManagerGuid; }
+ }
+
+ }
+}
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=1528583&r1=1528582&r2=1528583&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 Oct 2 18:08:31 2013
@@ -59,7 +59,7 @@ namespace Apache.NMS.ActiveMQ.OpenWire
PreferredWireFormatInfo.MaxInactivityDuration = 30000;
PreferredWireFormatInfo.MaxInactivityDurationInitialDelay = 10000;
PreferredWireFormatInfo.CacheSize = 0;
- PreferredWireFormatInfo.Version = 9;
+ PreferredWireFormatInfo.Version = 10;
dataMarshallers = new BaseDataStreamMarshaller[256];
Version = 1;
Added: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBlobMessageMarshaller.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBlobMessageMarshaller.cs?rev=1528583&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBlobMessageMarshaller.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBlobMessageMarshaller.cs Wed Oct 2 18:08:31 2013
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ *
+ * Marshaler code for OpenWire format for ActiveMQBlobMessage
+ *
+ * NOTE!: This file is auto generated - do not modify!
+ * if you need to make a change, please see the Java Classes
+ * in the nms-activemq-openwire-generator module
+ *
+ */
+
+using System;
+using System.IO;
+
+using Apache.NMS.ActiveMQ.Commands;
+
+namespace Apache.NMS.ActiveMQ.OpenWire.V10
+{
+ /// <summary>
+ /// Marshalling code for Open Wire Format for ActiveMQBlobMessage
+ /// </summary>
+ class ActiveMQBlobMessageMarshaller : ActiveMQMessageMarshaller
+ {
+ /// <summery>
+ /// Creates an instance of the Object that this marshaller handles.
+ /// </summery>
+ public override DataStructure CreateObject()
+ {
+ return new ActiveMQBlobMessage();
+ }
+
+ /// <summery>
+ /// Returns the type code for the Object that this Marshaller handles..
+ /// </summery>
+ public override byte GetDataStructureType()
+ {
+ return ActiveMQBlobMessage.ID_ACTIVEMQBLOBMESSAGE;
+ }
+
+ //
+ // Un-marshal an object instance from the data input stream
+ //
+ public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
+ {
+ base.TightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ActiveMQBlobMessage info = (ActiveMQBlobMessage)o;
+ info.RemoteBlobUrl = TightUnmarshalString(dataIn, bs);
+ info.MimeType = TightUnmarshalString(dataIn, bs);
+ info.DeletedByBroker = bs.ReadBoolean();
+ }
+
+ //
+ // Write the booleans that this object uses to a BooleanStream
+ //
+ public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
+ {
+ ActiveMQBlobMessage info = (ActiveMQBlobMessage)o;
+
+ int rc = base.TightMarshal1(wireFormat, o, bs);
+ rc += TightMarshalString1(info.RemoteBlobUrl, bs);
+ rc += TightMarshalString1(info.MimeType, bs);
+ bs.WriteBoolean(info.DeletedByBroker);
+
+ return rc + 0;
+ }
+
+ //
+ // Write a object instance to data output stream
+ //
+ public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs)
+ {
+ base.TightMarshal2(wireFormat, o, dataOut, bs);
+
+ ActiveMQBlobMessage info = (ActiveMQBlobMessage)o;
+ TightMarshalString2(info.RemoteBlobUrl, dataOut, bs);
+ TightMarshalString2(info.MimeType, dataOut, bs);
+ bs.ReadBoolean();
+ }
+
+ //
+ // Un-marshal an object instance from the data input stream
+ //
+ public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
+ {
+ base.LooseUnmarshal(wireFormat, o, dataIn);
+
+ ActiveMQBlobMessage info = (ActiveMQBlobMessage)o;
+ info.RemoteBlobUrl = LooseUnmarshalString(dataIn);
+ info.MimeType = LooseUnmarshalString(dataIn);
+ info.DeletedByBroker = dataIn.ReadBoolean();
+ }
+
+ //
+ // Write a object instance to data output stream
+ //
+ public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
+ {
+
+ ActiveMQBlobMessage info = (ActiveMQBlobMessage)o;
+
+ base.LooseMarshal(wireFormat, o, dataOut);
+ LooseMarshalString(info.RemoteBlobUrl, dataOut);
+ LooseMarshalString(info.MimeType, dataOut);
+ dataOut.Write(info.DeletedByBroker);
+ }
+ }
+}
Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBlobMessageMarshaller.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBytesMessageMarshaller.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBytesMessageMarshaller.cs?rev=1528583&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBytesMessageMarshaller.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBytesMessageMarshaller.cs Wed Oct 2 18:08:31 2013
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ *
+ * Marshaler code for OpenWire format for ActiveMQBytesMessage
+ *
+ * NOTE!: This file is auto generated - do not modify!
+ * if you need to make a change, please see the Java Classes
+ * in the nms-activemq-openwire-generator module
+ *
+ */
+
+using System;
+using System.IO;
+
+using Apache.NMS.ActiveMQ.Commands;
+
+namespace Apache.NMS.ActiveMQ.OpenWire.V10
+{
+ /// <summary>
+ /// Marshalling code for Open Wire Format for ActiveMQBytesMessage
+ /// </summary>
+ class ActiveMQBytesMessageMarshaller : ActiveMQMessageMarshaller
+ {
+ /// <summery>
+ /// Creates an instance of the Object that this marshaller handles.
+ /// </summery>
+ public override DataStructure CreateObject()
+ {
+ return new ActiveMQBytesMessage();
+ }
+
+ /// <summery>
+ /// Returns the type code for the Object that this Marshaller handles..
+ /// </summery>
+ public override byte GetDataStructureType()
+ {
+ return ActiveMQBytesMessage.ID_ACTIVEMQBYTESMESSAGE;
+ }
+
+ //
+ // Un-marshal an object instance from the data input stream
+ //
+ public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
+ {
+ base.TightUnmarshal(wireFormat, o, dataIn, bs);
+ }
+
+ //
+ // Write the booleans that this object uses to a BooleanStream
+ //
+ public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
+ {
+
+ int rc = base.TightMarshal1(wireFormat, o, bs);
+
+ return rc + 0;
+ }
+
+ //
+ // Write a object instance to data output stream
+ //
+ public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs)
+ {
+ base.TightMarshal2(wireFormat, o, dataOut, bs);
+ }
+
+ //
+ // Un-marshal an object instance from the data input stream
+ //
+ public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
+ {
+ base.LooseUnmarshal(wireFormat, o, dataIn);
+ }
+
+ //
+ // Write a object instance to data output stream
+ //
+ public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
+ {
+
+ base.LooseMarshal(wireFormat, o, dataOut);
+ }
+ }
+}
Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQBytesMessageMarshaller.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQDestinationMarshaller.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQDestinationMarshaller.cs?rev=1528583&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQDestinationMarshaller.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQDestinationMarshaller.cs Wed Oct 2 18:08:31 2013
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ *
+ * Marshaler code for OpenWire format for ActiveMQDestination
+ *
+ * NOTE!: This file is auto generated - do not modify!
+ * if you need to make a change, please see the Java Classes
+ * in the nms-activemq-openwire-generator module
+ *
+ */
+
+using System;
+using System.IO;
+
+using Apache.NMS.ActiveMQ.Commands;
+
+namespace Apache.NMS.ActiveMQ.OpenWire.V10
+{
+ /// <summary>
+ /// Marshalling code for Open Wire Format for ActiveMQDestination
+ /// </summary>
+ abstract class ActiveMQDestinationMarshaller : BaseDataStreamMarshaller
+ {
+
+ //
+ // Un-marshal an object instance from the data input stream
+ //
+ public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
+ {
+ base.TightUnmarshal(wireFormat, o, dataIn, bs);
+
+ ActiveMQDestination info = (ActiveMQDestination)o;
+ info.PhysicalName = TightUnmarshalString(dataIn, bs);
+ }
+
+ //
+ // Write the booleans that this object uses to a BooleanStream
+ //
+ public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
+ {
+ ActiveMQDestination info = (ActiveMQDestination)o;
+
+ int rc = base.TightMarshal1(wireFormat, o, bs);
+ rc += TightMarshalString1(info.PhysicalName, bs);
+
+ return rc + 0;
+ }
+
+ //
+ // Write a object instance to data output stream
+ //
+ public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs)
+ {
+ base.TightMarshal2(wireFormat, o, dataOut, bs);
+
+ ActiveMQDestination info = (ActiveMQDestination)o;
+ TightMarshalString2(info.PhysicalName, dataOut, bs);
+ }
+
+ //
+ // Un-marshal an object instance from the data input stream
+ //
+ public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
+ {
+ base.LooseUnmarshal(wireFormat, o, dataIn);
+
+ ActiveMQDestination info = (ActiveMQDestination)o;
+ info.PhysicalName = LooseUnmarshalString(dataIn);
+ }
+
+ //
+ // Write a object instance to data output stream
+ //
+ public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
+ {
+
+ ActiveMQDestination info = (ActiveMQDestination)o;
+
+ base.LooseMarshal(wireFormat, o, dataOut);
+ LooseMarshalString(info.PhysicalName, dataOut);
+ }
+ }
+}
Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQDestinationMarshaller.cs
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQMapMessageMarshaller.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQMapMessageMarshaller.cs?rev=1528583&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQMapMessageMarshaller.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQMapMessageMarshaller.cs Wed Oct 2 18:08:31 2013
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ *
+ * Marshaler code for OpenWire format for ActiveMQMapMessage
+ *
+ * NOTE!: This file is auto generated - do not modify!
+ * if you need to make a change, please see the Java Classes
+ * in the nms-activemq-openwire-generator module
+ *
+ */
+
+using System;
+using System.IO;
+
+using Apache.NMS.ActiveMQ.Commands;
+
+namespace Apache.NMS.ActiveMQ.OpenWire.V10
+{
+ /// <summary>
+ /// Marshalling code for Open Wire Format for ActiveMQMapMessage
+ /// </summary>
+ class ActiveMQMapMessageMarshaller : ActiveMQMessageMarshaller
+ {
+ /// <summery>
+ /// Creates an instance of the Object that this marshaller handles.
+ /// </summery>
+ public override DataStructure CreateObject()
+ {
+ return new ActiveMQMapMessage();
+ }
+
+ /// <summery>
+ /// Returns the type code for the Object that this Marshaller handles..
+ /// </summery>
+ public override byte GetDataStructureType()
+ {
+ return ActiveMQMapMessage.ID_ACTIVEMQMAPMESSAGE;
+ }
+
+ //
+ // Un-marshal an object instance from the data input stream
+ //
+ public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
+ {
+ base.TightUnmarshal(wireFormat, o, dataIn, bs);
+ }
+
+ //
+ // Write the booleans that this object uses to a BooleanStream
+ //
+ public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
+ {
+
+ int rc = base.TightMarshal1(wireFormat, o, bs);
+
+ return rc + 0;
+ }
+
+ //
+ // Write a object instance to data output stream
+ //
+ public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs)
+ {
+ base.TightMarshal2(wireFormat, o, dataOut, bs);
+ }
+
+ //
+ // Un-marshal an object instance from the data input stream
+ //
+ public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
+ {
+ base.LooseUnmarshal(wireFormat, o, dataIn);
+ }
+
+ //
+ // Write a object instance to data output stream
+ //
+ public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
+ {
+
+ base.LooseMarshal(wireFormat, o, dataOut);
+ }
+ }
+}
Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/V10/ActiveMQMapMessageMarshaller.cs
------------------------------------------------------------------------------
svn:eol-style = native