From 55fa95460ce5b9fe208771733b8c500215a70b38 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Fri, 2 Mar 2007 19:59:21 +0000 Subject: [PATCH] transports copy messages after serializing them on to the wire. So move copy on send into the vm:// transport only git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@513920 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/activemq/ActiveMQSession.java | 3 --- .../java/org/apache/activemq/transport/vm/VMTransport.java | 7 +++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java index b6a16e381b..008dc29267 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQSession.java @@ -1585,9 +1585,6 @@ public class ActiveMQSession implements Session, QueueSession, TopicSession, Sta message.setJMSMessageID(msg.getMessageId().toString()); } msg.setTransactionId(txid); - if(connection.isCopyMessageOnSend()){ - msg=(ActiveMQMessage)msg.copy(); - } msg.setConnection(connection); msg.onSend(); msg.setProducerId(msg.getMessageId().getProducerId()); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java index f4bbf03ae8..6d205f6d07 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.atomic.AtomicLong; import org.apache.activemq.command.Command; +import org.apache.activemq.command.Message; import org.apache.activemq.thread.Task; import org.apache.activemq.thread.TaskRunner; import org.apache.activemq.thread.TaskRunnerFactory; @@ -73,6 +74,9 @@ public class VMTransport implements Transport,Task{ } public void oneway(Object command) throws IOException{ + if (command instanceof Message) { + command = ((Message)command).copy(); + } if(disposed){ throw new TransportDisposedIOException("Transport disposed."); } @@ -90,6 +94,9 @@ public class VMTransport implements Transport,Task{ } protected void syncOneWay(Object command){ + if (command instanceof Message) { + command = ((Message)command).copy(); + } final TransportListener tl=peer.transportListener; prePeerSetQueue=peer.prePeerSetQueue; if(tl==null){