Class ZeroconfDiscoveryAgent
- java.lang.Object
-
- org.apache.activemq.transport.discovery.zeroconf.ZeroconfDiscoveryAgent
-
- All Implemented Interfaces:
EventListener,javax.jmdns.ServiceListener,Service,DiscoveryAgent
public class ZeroconfDiscoveryAgent extends Object implements DiscoveryAgent, javax.jmdns.ServiceListener
-
-
Constructor Summary
Constructors Constructor Description ZeroconfDiscoveryAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddService(javax.jmdns.JmDNS jmDNS, String type, String name)protected javax.jmdns.JmDNScreateJmDNS()protected InetAddresscreateLocalAddress()protected javax.jmdns.ServiceInfocreateServiceInfo(String name, Map map)StringgetGroup()javax.jmdns.JmDNSgetJmdns()InetAddressgetLocalAddress()StringgetLocalhost()intgetPriority()StringgetType()intgetWeight()voidregisterService(String name)register a servicevoidremoveService(javax.jmdns.JmDNS jmDNS, String type, String name)voidresolveService(javax.jmdns.JmDNS jmDNS, String type, String name, javax.jmdns.ServiceInfo serviceInfo)voidserviceAdded(javax.jmdns.ServiceEvent event)voidserviceFailed(DiscoveryEvent event)A process actively using a service may see it go down before the DiscoveryAgent notices the service's failure.voidserviceRemoved(javax.jmdns.ServiceEvent event)voidserviceResolved(javax.jmdns.ServiceEvent event)voidsetDiscoveryListener(DiscoveryListener listener)Sets the discovery listenervoidsetGroup(String group)voidsetJmdns(javax.jmdns.JmDNS jmdns)voidsetLocalAddress(InetAddress localAddress)voidsetLocalhost(String localhost)voidsetPriority(int priority)voidsetType(String typeSuffix)voidsetWeight(int weight)voidstart()voidstop()
-
-
-
Method Detail
-
start
public void start() throws Exception
-
registerService
public void registerService(String name) throws IOException
Description copied from interface:DiscoveryAgentregister a service- Specified by:
registerServicein interfaceDiscoveryAgent- Throws:
IOException
-
serviceAdded
public void serviceAdded(javax.jmdns.ServiceEvent event)
- Specified by:
serviceAddedin interfacejavax.jmdns.ServiceListener
-
serviceRemoved
public void serviceRemoved(javax.jmdns.ServiceEvent event)
- Specified by:
serviceRemovedin interfacejavax.jmdns.ServiceListener
-
serviceResolved
public void serviceResolved(javax.jmdns.ServiceEvent event)
- Specified by:
serviceResolvedin interfacejavax.jmdns.ServiceListener
-
resolveService
public void resolveService(javax.jmdns.JmDNS jmDNS, String type, String name, javax.jmdns.ServiceInfo serviceInfo)
-
getPriority
public int getPriority()
-
setPriority
public void setPriority(int priority)
-
getWeight
public int getWeight()
-
setWeight
public void setWeight(int weight)
-
getJmdns
public javax.jmdns.JmDNS getJmdns() throws IOException- Throws:
IOException
-
setJmdns
public void setJmdns(javax.jmdns.JmDNS jmdns)
-
getLocalAddress
public InetAddress getLocalAddress() throws UnknownHostException
- Throws:
UnknownHostException
-
setLocalAddress
public void setLocalAddress(InetAddress localAddress)
-
getLocalhost
public String getLocalhost()
-
setLocalhost
public void setLocalhost(String localhost)
-
createJmDNS
protected javax.jmdns.JmDNS createJmDNS() throws IOException- Throws:
IOException
-
createLocalAddress
protected InetAddress createLocalAddress() throws UnknownHostException
- Throws:
UnknownHostException
-
setDiscoveryListener
public void setDiscoveryListener(DiscoveryListener listener)
Description copied from interface:DiscoveryAgentSets the discovery listener- Specified by:
setDiscoveryListenerin interfaceDiscoveryAgent
-
getGroup
public String getGroup()
-
setGroup
public void setGroup(String group)
-
setType
public void setType(String typeSuffix)
-
getType
public String getType()
-
serviceFailed
public void serviceFailed(DiscoveryEvent event) throws IOException
Description copied from interface:DiscoveryAgentA process actively using a service may see it go down before the DiscoveryAgent notices the service's failure. That process can use this method to notify the DiscoveryAgent of the failure so that other listeners of this DiscoveryAgent can also be made aware of the failure.- Specified by:
serviceFailedin interfaceDiscoveryAgent- Throws:
IOException
-
-