From 3daf923b510d3c626e9341567593ba7dcfccaad2 Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Tue, 7 Nov 2006 16:56:12 +0000 Subject: [PATCH] Added some fields for future use to the BrokerInfo and ProducerInfo classes. git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@472165 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/command/BrokerInfo.java | 16 ++++++++++++++++ .../apache/activemq/command/ProducerInfo.java | 16 ++++++++++++++++ .../openwire/v2/BrokerInfoMarshaller.java | 5 +++++ .../openwire/v2/ProducerInfoMarshaller.java | 5 +++++ .../activemq/openwire/v2/BrokerInfoTest.java | 1 + .../activemq/openwire/v2/ProducerInfoTest.java | 1 + 6 files changed, 44 insertions(+) diff --git a/activemq-core/src/main/java/org/apache/activemq/command/BrokerInfo.java b/activemq-core/src/main/java/org/apache/activemq/command/BrokerInfo.java index 596b901c6f..98695d00c5 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/BrokerInfo.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/BrokerInfo.java @@ -37,6 +37,7 @@ public class BrokerInfo extends BaseCommand{ boolean duplexConnection; BrokerInfo peerBrokerInfos[]; String brokerName; + long connectionId; public boolean isBrokerInfo(){ return true; @@ -169,4 +170,19 @@ public class BrokerInfo extends BaseCommand{ public void setNetworkConnection(boolean networkConnection){ this.networkConnection=networkConnection; } + + /** + * The broker assigns a each connection it accepts a connection id. + * + * @openwire:property version=2 + */ + public long getConnectionId() { + return connectionId; + } + + public void setConnectionId(long connectionId) { + this.connectionId = connectionId; + } + + } diff --git a/activemq-core/src/main/java/org/apache/activemq/command/ProducerInfo.java b/activemq-core/src/main/java/org/apache/activemq/command/ProducerInfo.java index 2ace4cf8d8..63b73d1cc0 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/ProducerInfo.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/ProducerInfo.java @@ -31,6 +31,7 @@ public class ProducerInfo extends BaseCommand { protected ProducerId producerId; protected ActiveMQDestination destination; protected BrokerId[] brokerPath; + protected boolean dispatchAsync; public ProducerInfo() { } @@ -101,4 +102,19 @@ public class ProducerInfo extends BaseCommand { return visitor.processAddProducer( this ); } + /** + * If the broker should dispatch messages from this producer async. Since sync + * dispatch could potentally block the producer thread, this could be an important + * setting for the producer. + * + * @openwire:property version=2 + */ + public boolean isDispatchAsync() { + return dispatchAsync; + } + + public void setDispatchAsync(boolean dispatchAsync) { + this.dispatchAsync = dispatchAsync; + } + } diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BrokerInfoMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BrokerInfoMarshaller.java index 564ddd1f48..73abe5bcea 100644 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BrokerInfoMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v2/BrokerInfoMarshaller.java @@ -86,6 +86,7 @@ public class BrokerInfoMarshaller extends BaseCommandMarshaller { info.setFaultTolerantConfiguration(bs.readBoolean()); info.setDuplexConnection(bs.readBoolean()); info.setNetworkConnection(bs.readBoolean()); + info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs)); } @@ -107,6 +108,7 @@ public class BrokerInfoMarshaller extends BaseCommandMarshaller { bs.writeBoolean(info.isFaultTolerantConfiguration()); bs.writeBoolean(info.isDuplexConnection()); bs.writeBoolean(info.isNetworkConnection()); + rc+=tightMarshalLong1(wireFormat, info.getConnectionId(), bs); return rc + 0; } @@ -131,6 +133,7 @@ public class BrokerInfoMarshaller extends BaseCommandMarshaller { bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); + tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs); } @@ -165,6 +168,7 @@ public class BrokerInfoMarshaller extends BaseCommandMarshaller { info.setFaultTolerantConfiguration(dataIn.readBoolean()); info.setDuplexConnection(dataIn.readBoolean()); info.setNetworkConnection(dataIn.readBoolean()); + info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn)); } @@ -186,6 +190,7 @@ public class BrokerInfoMarshaller extends BaseCommandMarshaller { dataOut.writeBoolean(info.isFaultTolerantConfiguration()); dataOut.writeBoolean(info.isDuplexConnection()); dataOut.writeBoolean(info.isNetworkConnection()); + looseMarshalLong(wireFormat, info.getConnectionId(), dataOut); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/v2/ProducerInfoMarshaller.java b/activemq-core/src/main/java/org/apache/activemq/openwire/v2/ProducerInfoMarshaller.java index b11835c18b..bc152dd049 100644 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/v2/ProducerInfoMarshaller.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/v2/ProducerInfoMarshaller.java @@ -80,6 +80,7 @@ public class ProducerInfoMarshaller extends BaseCommandMarshaller { else { info.setBrokerPath(null); } + info.setDispatchAsync(bs.readBoolean()); } @@ -95,6 +96,7 @@ public class ProducerInfoMarshaller extends BaseCommandMarshaller { rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getProducerId(), bs); rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs); rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); + bs.writeBoolean(info.isDispatchAsync()); return rc + 0; } @@ -113,6 +115,7 @@ public class ProducerInfoMarshaller extends BaseCommandMarshaller { tightMarshalCachedObject2(wireFormat, (DataStructure)info.getProducerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); + bs.readBoolean(); } @@ -141,6 +144,7 @@ public class ProducerInfoMarshaller extends BaseCommandMarshaller { else { info.setBrokerPath(null); } + info.setDispatchAsync(dataIn.readBoolean()); } @@ -156,6 +160,7 @@ public class ProducerInfoMarshaller extends BaseCommandMarshaller { looseMarshalCachedObject(wireFormat, (DataStructure)info.getProducerId(), dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); + dataOut.writeBoolean(info.isDispatchAsync()); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerInfoTest.java index fb2ba0c955..1abe7e47db 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/BrokerInfoTest.java @@ -66,5 +66,6 @@ public class BrokerInfoTest extends BaseCommandTestSupport { info.setFaultTolerantConfiguration(true); info.setDuplexConnection(false); info.setNetworkConnection(true); + info.setConnectionId(1); } } diff --git a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerInfoTest.java b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerInfoTest.java index db911a1071..f36fbbdf17 100644 --- a/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerInfoTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/openwire/v2/ProducerInfoTest.java @@ -60,5 +60,6 @@ public class ProducerInfoTest extends BaseCommandTestSupport { } info.setBrokerPath(value); } + info.setDispatchAsync(true); } }