Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 64913 invoked from network); 17 Apr 2008 18:10:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Apr 2008 18:10:29 -0000 Received: (qmail 43225 invoked by uid 500); 17 Apr 2008 18:10:30 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 43172 invoked by uid 500); 17 Apr 2008 18:10:30 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 43163 invoked by uid 99); 17 Apr 2008 18:10:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Apr 2008 11:10:30 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Apr 2008 18:09:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E98F11A9832; Thu, 17 Apr 2008 11:09:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r649211 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ main/java/org/apache/activemq/broker/jmx/ main/java/org/apache/activemq/proxy/ main/java/org/apache/activemq/transport/ main/java/org/apache/activemq/tran... Date: Thu, 17 Apr 2008 18:09:41 -0000 To: commits@activemq.apache.org From: chirino@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080417181001.E98F11A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: chirino Date: Thu Apr 17 11:09:37 2008 New Revision: 649211 URL: http://svn.apache.org/viewvc?rev=649211&view=rev Log: Fix for https://issues.apache.org/activemq/browse/AMQ-1670 you should now able able to add transports before configuring the reset of the broker properties. Also slightly changed the TransportFactory interface so that you are not forced to supply a brokerId to bind a transport. Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslBrokerService.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransportFactory.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ClientTestSupport.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportUsingServerTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java Thu Apr 17 11:09:37 2008 @@ -203,7 +203,7 @@ * @throws Exception */ public TransportConnector addConnector(URI bindAddress) throws Exception { - return addConnector(createTransportConnector(getBroker(), bindAddress)); + return addConnector(createTransportConnector(bindAddress)); } /** @@ -213,7 +213,7 @@ * @throws Exception */ public TransportConnector addConnector(TransportServer transport) throws Exception { - return addConnector(new TransportConnector(getBroker(), transport)); + return addConnector(new TransportConnector(transport)); } /** @@ -1665,9 +1665,9 @@ } } - protected TransportConnector createTransportConnector(Broker broker, URI brokerURI) throws Exception { + protected TransportConnector createTransportConnector(URI brokerURI) throws Exception { TransportServer transport = TransportFactory.bind(this, brokerURI); - return new TransportConnector(broker, transport); + return new TransportConnector(transport); } /** @@ -1825,8 +1825,6 @@ } protected TransportConnector startTransportConnector(TransportConnector connector) throws Exception { - connector.setBroker(getBroker()); - connector.setBrokerName(getBrokerName()); connector.setTaskRunnerFactory(getTaskRunnerFactory()); MessageAuthorizationPolicy policy = getMessageAuthorizationPolicy(); if (policy != null) { Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslBrokerService.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslBrokerService.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslBrokerService.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/SslBrokerService.java Thu Apr 17 11:09:37 2008 @@ -92,7 +92,7 @@ SslTransportFactory transportFactory = new SslTransportFactory(); transportFactory.setKeyAndTrustManagers(km, tm, random); - return transportFactory.doBind(getBrokerName(), brokerURI); + return transportFactory.doBind(brokerURI); } else { // Else, business as usual. return TransportFactory.bind(this, brokerURI); Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java Thu Apr 17 11:09:37 2008 @@ -170,7 +170,6 @@ this.statistics.setParent(connector.getStatistics()); } this.taskRunnerFactory = taskRunnerFactory; - connector.setBrokerName(broker.getBrokerName()); this.transport = transport; this.transport.setTransportListener(new DefaultTransportListener() { Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java Thu Apr 17 11:09:37 2008 @@ -52,7 +52,6 @@ protected CopyOnWriteArrayList connections = new CopyOnWriteArrayList(); protected TransportStatusDetector statusDector; - private Broker broker; private BrokerService brokerService; private TransportServer server; private URI uri; @@ -66,13 +65,13 @@ private String name; private boolean disableAsyncDispatch; private boolean enableStatusMonitor = false; + private Broker broker; public TransportConnector() { } - public TransportConnector(Broker broker, TransportServer server) { + public TransportConnector(TransportServer server) { this(); - setBroker(broker); setServer(server); if (server != null && server.getConnectURI() != null) { URI uri = server.getConnectURI(); @@ -96,8 +95,7 @@ * connector */ public ManagedTransportConnector asManagedConnector(MBeanServer mbeanServer, ObjectName connectorName) throws IOException, URISyntaxException { - ManagedTransportConnector rc = new ManagedTransportConnector(mbeanServer, connectorName, getBroker(), getServer()); - //rc.setBroker(getBroker()); + ManagedTransportConnector rc = new ManagedTransportConnector(mbeanServer, connectorName, getServer()); rc.setBrokerInfo(getBrokerInfo()); rc.setConnectUri(getConnectUri()); rc.setDisableAsyncDispatch(isDisableAsyncDispatch()); @@ -106,9 +104,9 @@ rc.setEnableStatusMonitor(isEnableStatusMonitor()); rc.setMessageAuthorizationPolicy(getMessageAuthorizationPolicy()); rc.setName(getName()); - //rc.setServer(getServer()); rc.setTaskRunnerFactory(getTaskRunnerFactory()); rc.setUri(getUri()); + rc.setBrokerService(brokerService); return rc; } @@ -127,59 +125,8 @@ return server; } - public Broker getBroker() { - return broker; - } - - public void setBroker(Broker broker) { - this.broker = broker; - brokerInfo.setBrokerId(broker.getBrokerId()); - brokerInfo.setPeerBrokerInfos(broker.getPeerBrokerInfos()); - brokerInfo.setFaultTolerantConfiguration(broker.isFaultTolerantConfiguration()); - } - - public void setBrokerName(String brokerName) { - brokerInfo.setBrokerName(brokerName); - } - public void setServer(TransportServer server) { this.server = server; - this.brokerInfo.setBrokerURL(server.getConnectURI().toString()); - this.server.setAcceptListener(new TransportAcceptListener() { - public void onAccept(final Transport transport) { - try { - // Starting the connection could block due to - // wireformat negotiation, so start it in an async thread. - Thread startThread = new Thread("ActiveMQ Transport Initiator: " + transport.getRemoteAddress()) { - public void run() { - try { - Connection connection = createConnection(transport); - connection.start(); - } catch (Exception e) { - ServiceSupport.dispose(transport); - onAcceptError(e); - } - } - }; - startThread.setPriority(4); - startThread.start(); - } catch (Exception e) { - String remoteHost = transport.getRemoteAddress(); - ServiceSupport.dispose(transport); - onAcceptError(e, remoteHost); - } - } - - public void onAcceptError(Exception error) { - onAcceptError(error, null); - } - - private void onAcceptError(Exception error, String remoteHost) { - LOG.error("Could not accept connection " + (remoteHost == null ? "" : "from " + remoteHost) + ": " + error.getMessage()); - LOG.debug("Reason: " + error.getMessage(), error); - } - }); - this.server.setBrokerInfo(brokerInfo); } public URI getUri() { @@ -232,7 +179,54 @@ } public void start() throws Exception { - getServer().start(); + + TransportServer server = getServer(); + + broker = brokerService.getBroker(); + brokerInfo.setBrokerName(broker.getBrokerName()); + brokerInfo.setBrokerId(broker.getBrokerId()); + brokerInfo.setPeerBrokerInfos(broker.getPeerBrokerInfos()); + brokerInfo.setFaultTolerantConfiguration(broker.isFaultTolerantConfiguration()); + brokerInfo.setBrokerURL(server.getConnectURI().toString()); + + server.setAcceptListener(new TransportAcceptListener() { + public void onAccept(final Transport transport) { + try { + // Starting the connection could block due to + // wireformat negotiation, so start it in an async thread. + Thread startThread = new Thread("ActiveMQ Transport Initiator: " + transport.getRemoteAddress()) { + public void run() { + try { + Connection connection = createConnection(transport); + connection.start(); + } catch (Exception e) { + ServiceSupport.dispose(transport); + onAcceptError(e); + } + } + }; + startThread.setPriority(4); + startThread.start(); + } catch (Exception e) { + String remoteHost = transport.getRemoteAddress(); + ServiceSupport.dispose(transport); + onAcceptError(e, remoteHost); + } + } + + public void onAcceptError(Exception error) { + onAcceptError(error, null); + } + + private void onAcceptError(Exception error, String remoteHost) { + LOG.error("Could not accept connection " + (remoteHost == null ? "" : "from " + remoteHost) + ": " + error.getMessage()); + LOG.debug("Reason: " + error.getMessage(), error); + } + }); + + server.setBrokerInfo(brokerInfo); + server.start(); + DiscoveryAgent da = getDiscoveryAgent(); if (da != null) { da.registerService(getConnectUri().toString()); @@ -280,14 +274,10 @@ if (uri == null) { throw new IllegalArgumentException("You must specify either a server or uri property"); } - if (broker == null) { - throw new IllegalArgumentException("You must specify the broker property. Maybe this connector should be added to a broker?"); - } - if (brokerService != null) { - return TransportFactory.bind(brokerService, uri); - } else { - return TransportFactory.bind(broker.getBrokerId().getValue(), uri); + if (brokerService == null) { + throw new IllegalArgumentException("You must specify the brokerService property. Maybe this connector should be added to a broker?"); } + return TransportFactory.bind(brokerService, uri); } public DiscoveryAgent getDiscoveryAgent() throws IOException { @@ -381,7 +371,11 @@ this.enableStatusMonitor = enableStatusMonitor; } - public void setBrokerService(BrokerService brokerService) { - this.brokerService = brokerService; - } + public void setBrokerService(BrokerService brokerService) { + this.brokerService = brokerService; + } + + public Broker getBroker() { + return broker; + } } Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnector.java Thu Apr 17 11:09:37 2008 @@ -41,8 +41,8 @@ private final MBeanServer mbeanServer; private final ObjectName connectorName; - public ManagedTransportConnector(MBeanServer mbeanServer, ObjectName connectorName, Broker next, TransportServer server) { - super(next, server); + public ManagedTransportConnector(MBeanServer mbeanServer, ObjectName connectorName, TransportServer server) { + super(server); this.mbeanServer = mbeanServer; this.connectorName = connectorName; } Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java Thu Apr 17 11:09:37 2008 @@ -126,7 +126,7 @@ if (bind == null) { throw new IllegalArgumentException("You must specify either a server or the bind property"); } - return TransportFactory.bind((String)null, bind); + return TransportFactory.bind(bind); } private Transport createRemoteTransport() throws Exception { Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java Thu Apr 17 11:09:37 2008 @@ -41,7 +41,7 @@ private static final FactoryFinder WIREFORMAT_FACTORY_FINDER = new FactoryFinder("META-INF/services/org/apache/activemq/wireformat/"); private static final ConcurrentHashMap TRANSPORT_FACTORYS = new ConcurrentHashMap(); - public abstract TransportServer doBind(String brokerId, URI location) throws IOException; + public abstract TransportServer doBind(URI location) throws IOException; public Transport doConnect(URI location, Executor ex) throws Exception { return doConnect(location); @@ -103,17 +103,24 @@ return tf.doCompositeConnect(location, ex); } - public static TransportServer bind(String brokerId, URI location) throws IOException { + public static TransportServer bind(URI location) throws IOException { TransportFactory tf = findTransportFactory(location); - return tf.doBind(brokerId, location); + return tf.doBind(location); + } + + /** + * @deprecated + */ + public static TransportServer bind(String brokerId, URI location) throws IOException { + return bind(location); } public static TransportServer bind(BrokerService brokerService, URI location) throws IOException { TransportFactory tf = findTransportFactory(location); - if (tf instanceof BrokerServiceAware) { - ((BrokerServiceAware)tf).setBrokerService(brokerService); + if (brokerService != null && tf instanceof BrokerServiceAware) { + ((BrokerServiceAware)tf).setBrokerService(brokerService); } - return tf.doBind(brokerService.getBrokerName(), location); + return tf.doBind(location); } public Transport doConnect(URI location) throws Exception { Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryTransportFactory.java Thu Apr 17 11:09:37 2008 @@ -43,7 +43,7 @@ return transport; } - public TransportServer doBind(String brokerId, URI location) throws IOException { + public TransportServer doBind(URI location) throws IOException { throw new IOException("Invalid server URI: " + location); // try{ // CompositeData compositData=URISupport.parseComposite(location); Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransportFactory.java Thu Apr 17 11:09:37 2008 @@ -72,7 +72,7 @@ return transport; } - public TransportServer doBind(String brokerId, URI location) throws IOException { + public TransportServer doBind(URI location) throws IOException { throw new IOException("Invalid server URI: " + location); } Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransportFactory.java Thu Apr 17 11:09:37 2008 @@ -80,7 +80,7 @@ return transport; } - public TransportServer doBind(String brokerId, URI location) throws IOException { + public TransportServer doBind(URI location) throws IOException { throw new IOException("Invalid server URI: " + location); } Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransportFactory.java Thu Apr 17 11:09:37 2008 @@ -53,7 +53,7 @@ return transport; } - public TransportServer doBind(String brokerId, URI location) throws IOException { + public TransportServer doBind(URI location) throws IOException { throw new IOException("This protocol does not support being bound."); } Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/peer/PeerTransportFactory.java Thu Apr 17 11:09:37 2008 @@ -104,7 +104,7 @@ } } - public TransportServer doBind(String brokerId, URI location) throws IOException { + public TransportServer doBind(URI location) throws IOException { throw new IOException("This protocol does not support being bound."); } Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java Thu Apr 17 11:09:37 2008 @@ -74,7 +74,7 @@ /** * Overriding to use SslTransportServer and allow for proper reflection. */ - public TransportServer doBind(String brokerId, final URI location) throws IOException { + public TransportServer doBind(final URI location) throws IOException { try { Map options = new HashMap(URISupport.parseParamters(location)); Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java Thu Apr 17 11:09:37 2008 @@ -47,7 +47,7 @@ public class TcpTransportFactory extends TransportFactory { private static final Log LOG = LogFactory.getLog(TcpTransportFactory.class); - public TransportServer doBind(String brokerId, final URI location) throws IOException { + public TransportServer doBind(final URI location) throws IOException { try { Map options = new HashMap(URISupport.parseParamters(location)); Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java Thu Apr 17 11:09:37 2008 @@ -51,7 +51,7 @@ private static final Log log = LogFactory.getLog(TcpTransportFactory.class); - public TransportServer doBind(String brokerId, final URI location) throws IOException { + public TransportServer doBind(final URI location) throws IOException { try { Map options = new HashMap(URISupport.parseParamters(location)); if (options.containsKey("port")) { Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportFactory.java Thu Apr 17 11:09:37 2008 @@ -126,7 +126,8 @@ server = SERVERS.get(host); if (server == null) { server = (VMTransportServer)bind(location, true); - TransportConnector connector = new TransportConnector(broker.getBroker(), server); + TransportConnector connector = new TransportConnector(server); + connector.setBrokerService(broker); connector.setUri(location); connector.setTaskRunnerFactory(broker.getTaskRunnerFactory()); connector.start(); @@ -151,7 +152,7 @@ return transport; } - public TransportServer doBind(String brokerId, URI location) throws IOException { + public TransportServer doBind(URI location) throws IOException { return bind(location, false); } Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/AMQDeadlockTest3.java Thu Apr 17 11:09:37 2008 @@ -256,7 +256,6 @@ final TransportConnector tConnector = new TransportConnector(); tConnector.setUri(new URI(uri1)); - tConnector.setBrokerName(brokerName); tConnector.setName(brokerName + ".transportConnector"); brokerService.addConnector(tConnector); Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ClientTestSupport.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ClientTestSupport.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ClientTestSupport.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/ClientTestSupport.java Thu Apr 17 11:09:37 2008 @@ -58,7 +58,7 @@ try { broker = BrokerFactory.createBroker(new URI(this.brokerURL)); String brokerId = broker.getBrokerName(); - connector = new TransportConnector(broker.getBroker(), TransportFactory.bind(brokerId, new URI(this.brokerURL))) { + connector = new TransportConnector(TransportFactory.bind(new URI(this.brokerURL))) { // Hook into the connector so we can assert that the server // accepted a connection. protected org.apache.activemq.broker.Connection createConnection(org.apache.activemq.transport.Transport transport) throws IOException { @@ -66,7 +66,7 @@ return super.createConnection(transport); } }; - connector.start(); + broker.addConnector(connector); broker.start(); } catch (IOException e) { Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkTestSupport.java Thu Apr 17 11:09:37 2008 @@ -46,20 +46,25 @@ protected TransportConnector remoteConnector; protected void setUp() throws Exception { - super.setUp(); - connector = createConnector(); - connector.start(); - remotePersistenceAdapter = createRemotePersistenceAdapter(true); - remotePersistenceAdapter.start(); + remotePersistenceAdapter = createRemotePersistenceAdapter(true); remoteBroker = createRemoteBroker(remotePersistenceAdapter); - remoteBroker.start(); - BrokerRegistry.getInstance().bind("remotehost", remoteBroker); remoteConnector = createRemoteConnector(); - remoteConnector.start(); + remoteBroker.addConnector( remoteConnector ); + BrokerRegistry.getInstance().bind("remotehost", remoteBroker); + remoteBroker.start(); + } + + + protected BrokerService createBroker() throws Exception { + BrokerService broker = BrokerFactory.createBroker(new URI("broker:()/localhost?persistent=false&useJmx=false&")); + connector = createConnector(); + broker.addConnector(connector); + return broker; } + /** * @return * @throws Exception @@ -67,7 +72,7 @@ * @throws URISyntaxException */ protected TransportConnector createRemoteConnector() throws Exception, IOException, URISyntaxException { - return new TransportConnector(remoteBroker.getBroker(), TransportFactory.bind(broker.getBrokerName(), new URI(getRemoteURI()))); + return new TransportConnector(TransportFactory.bind(new URI(getRemoteURI()))); } /** @@ -78,7 +83,7 @@ * @throws URISyntaxException */ protected TransportConnector createConnector() throws Exception, IOException, URISyntaxException { - return new TransportConnector(broker.getBroker(), TransportFactory.bind(broker.getBrokerName(), new URI(getLocalURI()))); + return new TransportConnector(TransportFactory.bind(new URI(getLocalURI()))); } protected String getRemoteURI() { @@ -96,11 +101,6 @@ return remotePersistenceAdapter; } - protected BrokerService createBroker() throws Exception { - BrokerService broker = BrokerFactory.createBroker(new URI("broker:()/localhost?persistent=false&useJmx=false&")); - return broker; - } - protected BrokerService createRemoteBroker(PersistenceAdapter persistenceAdapter) throws Exception { BrokerService answer = new BrokerService(); answer.setBrokerName("remote"); @@ -148,11 +148,10 @@ remotePersistenceAdapter.stop(); remotePersistenceAdapter = createRemotePersistenceAdapter(false); remotePersistenceAdapter.start(); + remoteBroker = createRemoteBroker(remotePersistenceAdapter); + remoteBroker.addConnector(getRemoteURI()); remoteBroker.start(); - String brokerId = remoteBroker.getBrokerName(); - remoteConnector = new TransportConnector(remoteBroker.getBroker(), TransportFactory.bind(brokerId, new URI(getRemoteURI()))); - remoteConnector.start(); BrokerRegistry.getInstance().bind("remotehost", remoteBroker); } Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/InactivityMonitorTest.java Thu Apr 17 11:09:37 2008 @@ -95,7 +95,7 @@ * @throws Exception */ private void startTransportServer() throws IOException, URISyntaxException, Exception { - server = TransportFactory.bind("localhost", new URI("tcp://localhost:61616?trace=true&wireFormat.maxInactivityDuration=1000")); + server = TransportFactory.bind(new URI("tcp://localhost:61616?trace=true&wireFormat.maxInactivityDuration=1000")); server.setAcceptListener(this); server.start(); } Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java Thu Apr 17 11:09:37 2008 @@ -53,7 +53,7 @@ + (needClientAuth ? "true" : "false"); try { - sslTransportServer = (SslTransportServer)factory.doBind("brokerId", new URI( + sslTransportServer = (SslTransportServer)factory.doBind(new URI( "ssl://localhost:61616?" + options)); } catch (Exception e) { Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java Thu Apr 17 11:09:37 2008 @@ -90,7 +90,7 @@ * @throws Exception */ private void startServer(String uri) throws IOException, URISyntaxException, Exception { - server = TransportFactory.bind("localhost", new URI(uri)); + server = TransportFactory.bind(new URI(uri)); server.setAcceptListener(new TransportAcceptListener() { public void onAccept(Transport transport) { try { Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportUsingServerTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportUsingServerTest.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportUsingServerTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/udp/UdpTransportUsingServerTest.java Thu Apr 17 11:09:37 2008 @@ -57,7 +57,7 @@ } protected TransportServer createServer() throws Exception { - return TransportFactory.bind("byBroker", new URI(serverURI)); + return TransportFactory.bind(new URI(serverURI)); } protected Transport createConsumer() throws Exception { Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQDeadlockTestW4Brokers.java Thu Apr 17 11:09:37 2008 @@ -190,7 +190,6 @@ final TransportConnector tConnector = new TransportConnector(); tConnector.setUri(new URI(uri1)); - tConnector.setBrokerName(brokerName); tConnector.setName(brokerName + ".transportConnector"); brokerService.addConnector(tConnector); Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQFailoverIssue.java Thu Apr 17 11:09:37 2008 @@ -120,7 +120,6 @@ brokerService.setDestinationPolicy(policyMap); final TransportConnector tConnector = new TransportConnector(); tConnector.setUri(new URI(uri1)); - tConnector.setBrokerName(brokerName); tConnector.setName(brokerName + ".transportConnector"); brokerService.addConnector(tConnector); if (uri2 != null) { Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java?rev=649211&r1=649210&r2=649211&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java Thu Apr 17 11:09:37 2008 @@ -134,7 +134,6 @@ final TransportConnector tConnector = new TransportConnector(); tConnector.setUri(new URI(uri1)); - tConnector.setBrokerName(brokerName); tConnector.setName(brokerName + ".transportConnector"); brokerService.addConnector(tConnector);