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
This commit is contained in:
David Jencks 2008-03-24 07:59:50 +00:00
parent 5a868627e3
commit f4b30c4936
2 changed files with 8 additions and 3 deletions

View File

@ -130,8 +130,7 @@ public class VMTransportFactory extends TransportFactory{
} }
} }
VMTransport vmtransport=server.connect(); VMTransport vmtransport=server.connect(options);
IntrospectionSupport.setProperties(vmtransport,options);
Transport transport=vmtransport; Transport transport=vmtransport;
if(vmtransport.isMarshal()){ if(vmtransport.isMarshal()){
HashMap optionsCopy=new HashMap(options); HashMap optionsCopy=new HashMap(options);

View File

@ -20,6 +20,8 @@ package org.apache.activemq.transport.vm;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.URI; import java.net.URI;
import java.util.Map;
import java.util.HashMap;
import org.apache.activemq.command.BrokerInfo; import org.apache.activemq.command.BrokerInfo;
import org.apache.activemq.transport.MutexTransport; 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.Transport;
import org.apache.activemq.transport.TransportAcceptListener; import org.apache.activemq.transport.TransportAcceptListener;
import org.apache.activemq.transport.TransportServer; import org.apache.activemq.transport.TransportServer;
import org.apache.activemq.util.IntrospectionSupport;
import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger;
@ -62,8 +65,9 @@ public class VMTransportServer implements TransportServer {
/** /**
* @return new VMTransport * @return new VMTransport
* @throws IOException * @throws IOException
* @param options
*/ */
public VMTransport connect() throws IOException { public VMTransport connect(Map options) throws IOException {
TransportAcceptListener al; TransportAcceptListener al;
synchronized (this) { synchronized (this) {
if( disposed ) if( disposed )
@ -88,6 +92,8 @@ public class VMTransportServer implements TransportServer {
VMTransport server = new VMTransport(location); VMTransport server = new VMTransport(location);
client.setPeer(server); client.setPeer(server);
server.setPeer(client); server.setPeer(client);
IntrospectionSupport.setProperties(server,new HashMap(options));
IntrospectionSupport.setProperties(client,options);
al.onAccept(configure(server)); al.onAccept(configure(server));
return client; return client;
} }