From f4b30c49363ad3536b719cf8b6d98a329dae4c43 Mon Sep 17 00:00:00 2001 From: David Jencks Date: Mon, 24 Mar 2008 07:59:50 +0000 Subject: [PATCH] AMQ-1438 Force the vm transport to finish configuring itself when its constructed so brokerInfo is immediately available so XAResource.isSameRM() can work properly. Modified patch to make it more thread-safe. Original patch from Manu T George git-svn-id: https://svn.apache.org/repos/asf/activemq/branches/activemq-4.1@640340 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/activemq/transport/vm/VMTransportFactory.java | 3 +-- .../apache/activemq/transport/vm/VMTransportServer.java | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java index 9bbe63f34d..e873f23416 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java @@ -130,8 +130,7 @@ public class VMTransportFactory extends TransportFactory{ } } - VMTransport vmtransport=server.connect(); - IntrospectionSupport.setProperties(vmtransport,options); + VMTransport vmtransport=server.connect(options); Transport transport=vmtransport; if(vmtransport.isMarshal()){ HashMap optionsCopy=new HashMap(options); diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java index 9d135fabeb..957296ea9d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java @@ -20,6 +20,8 @@ package org.apache.activemq.transport.vm; import java.io.IOException; import java.net.InetSocketAddress; import java.net.URI; +import java.util.Map; +import java.util.HashMap; import org.apache.activemq.command.BrokerInfo; import org.apache.activemq.transport.MutexTransport; @@ -27,6 +29,7 @@ import org.apache.activemq.transport.ResponseCorrelator; import org.apache.activemq.transport.Transport; import org.apache.activemq.transport.TransportAcceptListener; import org.apache.activemq.transport.TransportServer; +import org.apache.activemq.util.IntrospectionSupport; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; @@ -62,8 +65,9 @@ public class VMTransportServer implements TransportServer { /** * @return new VMTransport * @throws IOException + * @param options */ - public VMTransport connect() throws IOException { + public VMTransport connect(Map options) throws IOException { TransportAcceptListener al; synchronized (this) { if( disposed ) @@ -88,6 +92,8 @@ public class VMTransportServer implements TransportServer { VMTransport server = new VMTransport(location); client.setPeer(server); server.setPeer(client); + IntrospectionSupport.setProperties(server,new HashMap(options)); + IntrospectionSupport.setProperties(client,options); al.onAccept(configure(server)); return client; }