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();
IntrospectionSupport.setProperties(vmtransport,options);
VMTransport vmtransport=server.connect(options);
Transport transport=vmtransport;
if(vmtransport.isMarshal()){
HashMap optionsCopy=new HashMap(options);

View File

@ -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;
}