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 void
addService(javax.jmdns.JmDNS jmDNS, String type, String name)
protected javax.jmdns.JmDNS
createJmDNS()
protected InetAddress
createLocalAddress()
protected javax.jmdns.ServiceInfo
createServiceInfo(String name, Map map)
String
getGroup()
javax.jmdns.JmDNS
getJmdns()
InetAddress
getLocalAddress()
String
getLocalhost()
int
getPriority()
String
getType()
int
getWeight()
void
registerService(String name)
register a servicevoid
removeService(javax.jmdns.JmDNS jmDNS, String type, String name)
void
resolveService(javax.jmdns.JmDNS jmDNS, String type, String name, javax.jmdns.ServiceInfo serviceInfo)
void
serviceAdded(javax.jmdns.ServiceEvent event)
void
serviceFailed(DiscoveryEvent event)
A process actively using a service may see it go down before the DiscoveryAgent notices the service's failure.void
serviceRemoved(javax.jmdns.ServiceEvent event)
void
serviceResolved(javax.jmdns.ServiceEvent event)
void
setDiscoveryListener(DiscoveryListener listener)
Sets the discovery listenervoid
setGroup(String group)
void
setJmdns(javax.jmdns.JmDNS jmdns)
void
setLocalAddress(InetAddress localAddress)
void
setLocalhost(String localhost)
void
setPriority(int priority)
void
setType(String typeSuffix)
void
setWeight(int weight)
void
start()
void
stop()
-
-
-
Constructor Detail
-
ZeroconfDiscoveryAgent
public ZeroconfDiscoveryAgent()
-
-
Method Detail
-
registerService
public void registerService(String name) throws IOException
Description copied from interface:DiscoveryAgent
register a service- Specified by:
registerService
in interfaceDiscoveryAgent
- Throws:
IOException
-
addService
public void addService(javax.jmdns.JmDNS jmDNS, String type, String name)
-
removeService
public void removeService(javax.jmdns.JmDNS jmDNS, String type, String name)
-
serviceAdded
public void serviceAdded(javax.jmdns.ServiceEvent event)
- Specified by:
serviceAdded
in interfacejavax.jmdns.ServiceListener
-
serviceRemoved
public void serviceRemoved(javax.jmdns.ServiceEvent event)
- Specified by:
serviceRemoved
in interfacejavax.jmdns.ServiceListener
-
serviceResolved
public void serviceResolved(javax.jmdns.ServiceEvent event)
- Specified by:
serviceResolved
in 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)
-
createServiceInfo
protected javax.jmdns.ServiceInfo createServiceInfo(String name, Map map)
-
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:DiscoveryAgent
Sets the discovery listener- Specified by:
setDiscoveryListener
in interfaceDiscoveryAgent
-
serviceFailed
public void serviceFailed(DiscoveryEvent event) throws IOException
Description copied from interface:DiscoveryAgent
A 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:
serviceFailed
in interfaceDiscoveryAgent
- Throws:
IOException
-
-