diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java b/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java index 65b2d09705..613f1e4bb3 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java @@ -229,7 +229,6 @@ public class TransportConnector implements Connector { getServer().start(); DiscoveryAgent da = getDiscoveryAgent(); if (da != null) { - da.setBrokerName(getBrokerInfo().getBrokerName()); da.registerService(getConnectUri().toString()); da.start(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java b/activemq-core/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java index 11d620f629..b5ebdf3273 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DiscoveryNetworkConnector.java @@ -141,7 +141,6 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco this.discoveryAgent = discoveryAgent; if (discoveryAgent != null) { this.discoveryAgent.setDiscoveryListener(this); - this.discoveryAgent.setBrokerName(getBrokerName()); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java index 22aed81c16..a2421f2e94 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/DiscoveryAgent.java @@ -52,11 +52,5 @@ public interface DiscoveryAgent extends Service { * so that other listeners of this DiscoveryAgent can also be made aware of the failure. */ void serviceFailed(DiscoveryEvent event) throws IOException; - - String getGroup(); - - void setGroup(String group); - - void setBrokerName(String brokerName); } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java index 0096944216..8c57f2be12 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java @@ -160,7 +160,6 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { private boolean loopBackMode; private Map brokersByService = new ConcurrentHashMap(); private String group = "default"; - private String brokerName; private URI discoveryURI; private InetAddress inetAddress; private SocketAddress sockAddress; @@ -200,43 +199,6 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { } } - /** - * Get the group used for discovery - * - * @return the group - */ - public String getGroup() { - return group; - } - - /** - * Set the group for discovery - * - * @param group - */ - public void setGroup(String group) { - this.group = group; - } - - /** - * @return Returns the brokerName. - */ - public String getBrokerName() { - return brokerName; - } - - /** - * @param brokerName The brokerName to set. - */ - public void setBrokerName(String brokerName) { - if (brokerName != null) { - brokerName = brokerName.replace('.', '-'); - brokerName = brokerName.replace(':', '-'); - brokerName = brokerName.replace('%', '-'); - this.brokerName = brokerName; - } - } - /** * @return Returns the loopBackMode. */ @@ -299,9 +261,6 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { if (group == null || group.length() == 0) { throw new IOException("You must specify a group to discover"); } - if (brokerName == null || brokerName.length() == 0) { - LOG.warn("brokerName not set"); - } String type = getType(); if (!type.endsWith(".")) { LOG.warn("The type '" + type + "' should end with '.' to be a valid Discovery type"); @@ -369,15 +328,11 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { if (payload.startsWith(ALIVE)) { String brokerName = getBrokerName(payload.substring(ALIVE.length())); String service = payload.substring(ALIVE.length() + brokerName.length() + 2); - if (!brokerName.equals(this.brokerName)) { - processAlive(brokerName, service); - } + processAlive(brokerName, service); } else { String brokerName = getBrokerName(payload.substring(DEAD.length())); String service = payload.substring(DEAD.length() + brokerName.length() + 2); - if (!brokerName.equals(this.brokerName)) { - processDead(brokerName, service); - } + processDead(service); } } } @@ -398,7 +353,7 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { if (selfService != null) { String payload = getType(); payload += started.get() ? ALIVE : DEAD; - payload += DELIMITER + brokerName + DELIMITER; + payload += DELIMITER + "localhost" + DELIMITER; payload += selfService; try { byte[] data = payload.getBytes(); @@ -439,7 +394,7 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { } } - private void processDead(String brokerName, String service) { + private void processDead(String service) { if (!service.equals(selfService)) { RemoteBrokerData data = brokersByService.remove(service); if (data != null && !data.isFailed()) { @@ -453,7 +408,7 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { for (Iterator i = brokersByService.values().iterator(); i.hasNext();) { RemoteBrokerData data = i.next(); if (data.getLastHeartBeat() < expireTime) { - processDead(brokerName, data.service); + processDead(data.service); } } } @@ -552,4 +507,8 @@ public class MulticastDiscoveryAgent implements DiscoveryAgent, Runnable { public void setUseExponentialBackOff(boolean useExponentialBackOff) { this.useExponentialBackOff = useExponentialBackOff; } + + public void setGroup(String group) { + this.group = group; + } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java index 2a4c80d74c..21c6442109 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java @@ -234,12 +234,4 @@ public class RendezvousDiscoveryAgent implements DiscoveryAgent, ServiceListener // TODO: is there a way to notify the JmDNS that the service failed? } - /** - * @param brokerName - * @see org.apache.activemq.transport.discovery.DiscoveryAgent#setBrokerName(java.lang.String) - */ - public void setBrokerName(String brokerName) { - // implementation of interface - - } } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java index 087e59f003..e155c0bab2 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java @@ -41,7 +41,6 @@ public class SimpleDiscoveryAgent implements DiscoveryAgent { private long minConnectTime = 500; private DiscoveryListener listener; private String services[] = new String[] {}; - private String group = "DEFAULT"; private final AtomicBoolean running = new AtomicBoolean(false); class SimpleDiscoveryEvent extends DiscoveryEvent { @@ -97,17 +96,6 @@ public class SimpleDiscoveryAgent implements DiscoveryAgent { } } - public String getGroup() { - return group; - } - - public void setGroup(String group) { - this.group = group; - } - - public void setBrokerName(String brokerName) { - } - public void serviceFailed(DiscoveryEvent devent) throws IOException { final SimpleDiscoveryEvent event = (SimpleDiscoveryEvent)devent; diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgentFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgentFactory.java index 4de72cab0e..f858af3bbd 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgentFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgentFactory.java @@ -36,7 +36,6 @@ public class SimpleDiscoveryAgentFactory extends DiscoveryAgentFactory { Map options = data.getParameters(); SimpleDiscoveryAgent rc = new SimpleDiscoveryAgent(); - rc.setGroup(uri.getHost()); IntrospectionSupport.setProperties(rc, options); rc.setServices(data.getComponents());