put back default Constructor on NetworkConnector - for now.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@374288 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-02-02 06:54:17 +00:00
parent fa74c3a859
commit d517eebfbc
2 changed files with 26 additions and 8 deletions

View File

@ -191,7 +191,7 @@ public class BrokerService implements Service {
* @throws Exception
*/
public NetworkConnector addNetworkConnector(URI discoveryAddress) throws Exception{
NetworkConnector connector=new NetworkConnector(this);
NetworkConnector connector=new NetworkConnector();
// add the broker name to the parameters if not set
connector.setUri(discoveryAddress);
return addNetworkConnector(connector);
@ -1000,6 +1000,7 @@ public class BrokerService implements Service {
for (Iterator iter = getNetworkConnectors().iterator(); iter.hasNext();) {
NetworkConnector connector = (NetworkConnector) iter.next();
connector.setBrokerName(getBrokerName());
connector.start();
}

View File

@ -42,19 +42,20 @@ import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
public class NetworkConnector implements Service, DiscoveryListener {
private static final Log log = LogFactory.getLog(NetworkConnector.class);
private BrokerService brokerService;
private String brokerName = "localhost";
private DiscoveryAgent discoveryAgent;
private URI localURI;
private ConcurrentHashMap bridges = new ConcurrentHashMap();
boolean failover=true;
public NetworkConnector(BrokerService service) {
this.brokerService = service;
public NetworkConnector(){
}
public NetworkConnector(BrokerService service,URI localURI, DiscoveryAgent discoveryAgent) throws IOException {
this.brokerService = service;
public NetworkConnector(URI localURI, DiscoveryAgent discoveryAgent) throws IOException {
this.localURI = localURI;
setDiscoveryAgent(discoveryAgent);
}
@ -164,7 +165,7 @@ public class NetworkConnector implements Service, DiscoveryListener {
this.discoveryAgent = discoveryAgent;
if (discoveryAgent != null) {
this.discoveryAgent.setDiscoveryListener(this);
this.discoveryAgent.setBrokerName(brokerService.getBrokerName());
this.discoveryAgent.setBrokerName(brokerName);
}
}
@ -193,7 +194,7 @@ public class NetworkConnector implements Service, DiscoveryListener {
}
}
};
result.setLocalBrokerName(brokerService.getBrokerName());
result.setLocalBrokerName(brokerName);
return result;
}
@ -207,4 +208,20 @@ public class NetworkConnector implements Service, DiscoveryListener {
this.failover = reliable;
}
/**
* @return Returns the brokerName.
*/
public String getBrokerName(){
return brokerName;
}
/**
* @param brokerName The brokerName to set.
*/
public void setBrokerName(String brokerName){
this.brokerName=brokerName;
}
}