mattrpav commented on code in PR #1659:
URL: https://github.com/apache/activemq/pull/1659#discussion_r2795059309
##########
activemq-broker/src/main/java/org/apache/activemq/transport/vm/VMTransport.java:
##########
@@ -94,6 +97,30 @@ public void oneway(Object command) throws IOException {
throw new TransportDisposedIOException("Peer (" +
peer.toString() + ") disposed.");
}
+ // Deep copy the message if it is a MessageDispatch
+ Object toSend = command;
+ if (command instanceof MessageDispatch) {
+ MessageDispatch original = (MessageDispatch) command;
+ try {
+ WireFormat wf = new OpenWireFormat();
+ ByteSequence data = wf.marshal(original);
+ toSend = wf.unmarshal(data); // deep copy
+ } catch (IOException e) {
+ LOG.warn("Failed to deep copy MessageDispatch, sending
original", e);
+ toSend = command;
Review Comment:
command.copy() should suffice here
edit: Agree, we definitely don't want to instantiate an OpenWireFormat
object per-message here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact