Class MulticastDiscoveryAgent
- java.lang.Object
-
- org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent
-
- All Implemented Interfaces:
Runnable,Service,DiscoveryAgent
public class MulticastDiscoveryAgent extends Object implements DiscoveryAgent, Runnable
ADiscoveryAgentusing a multicast address and heartbeat packets encoded using any wireformat, but openwire by default.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_DISCOVERY_URI_STRINGstatic StringDEFAULT_HOST_IPstatic StringDEFAULT_HOST_STRstatic intDEFAULT_PORT
-
Constructor Summary
Constructors Constructor Description MulticastDiscoveryAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetBackOffMultiplier()URIgetDiscoveryURI()longgetInitialReconnectDelay()longgetKeepAliveInterval()intgetMaxReconnectAttempts()longgetMaxReconnectDelay()intgetTimeToLive()StringgetType()booleanisLoopBackMode()booleanisUseExponentialBackOff()voidregisterService(String name)register a servicevoidrun()voidserviceFailed(DiscoveryEvent event)A process actively using a service may see it go down before the DiscoveryAgent notices the service's failure.voidsetBackOffMultiplier(long backOffMultiplier)voidsetDiscoveryListener(DiscoveryListener listener)Set the discovery listenervoidsetDiscoveryURI(URI discoveryURI)Set the discoveryURIvoidsetGroup(String group)voidsetInitialReconnectDelay(long initialReconnectDelay)voidsetInterface(String mcInterface)voidsetJoinNetworkInterface(String mcJoinNetwrokInterface)voidsetKeepAliveInterval(long keepAliveInterval)voidsetLoopBackMode(boolean loopBackMode)voidsetMaxReconnectAttempts(int maxReconnectAttempts)voidsetMaxReconnectDelay(long maxReconnectDelay)voidsetNetworkInterface(String mcNetworkInterface)voidsetTimeToLive(int timeToLive)voidsetUseExponentialBackOff(boolean useExponentialBackOff)voidstart()start the discovery agentvoidstop()stop the channelStringtoString()
-
-
-
Field Detail
-
DEFAULT_DISCOVERY_URI_STRING
public static final String DEFAULT_DISCOVERY_URI_STRING
- See Also:
- Constant Field Values
-
DEFAULT_HOST_STR
public static final String DEFAULT_HOST_STR
- See Also:
- Constant Field Values
-
DEFAULT_HOST_IP
public static final String DEFAULT_HOST_IP
-
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
-
Method Detail
-
setDiscoveryListener
public void setDiscoveryListener(DiscoveryListener listener)
Set the discovery listener- Specified by:
setDiscoveryListenerin interfaceDiscoveryAgent- Parameters:
listener-
-
registerService
public void registerService(String name) throws IOException
register a service- Specified by:
registerServicein interfaceDiscoveryAgent- Throws:
IOException
-
isLoopBackMode
public boolean isLoopBackMode()
- Returns:
- Returns the loopBackMode.
-
setLoopBackMode
public void setLoopBackMode(boolean loopBackMode)
- Parameters:
loopBackMode- The loopBackMode to set.
-
getTimeToLive
public int getTimeToLive()
- Returns:
- Returns the timeToLive.
-
setTimeToLive
public void setTimeToLive(int timeToLive)
- Parameters:
timeToLive- The timeToLive to set.
-
getDiscoveryURI
public URI getDiscoveryURI()
- Returns:
- the discoveryURI
-
setDiscoveryURI
public void setDiscoveryURI(URI discoveryURI)
Set the discoveryURI- Parameters:
discoveryURI-
-
getKeepAliveInterval
public long getKeepAliveInterval()
-
setKeepAliveInterval
public void setKeepAliveInterval(long keepAliveInterval)
-
setInterface
public void setInterface(String mcInterface)
-
setNetworkInterface
public void setNetworkInterface(String mcNetworkInterface)
-
setJoinNetworkInterface
public void setJoinNetworkInterface(String mcJoinNetwrokInterface)
-
start
public void start() throws Exceptionstart the discovery agent
-
stop
public void stop() throws Exceptionstop the channel
-
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
-
getBackOffMultiplier
public long getBackOffMultiplier()
-
setBackOffMultiplier
public void setBackOffMultiplier(long backOffMultiplier)
-
getInitialReconnectDelay
public long getInitialReconnectDelay()
-
setInitialReconnectDelay
public void setInitialReconnectDelay(long initialReconnectDelay)
-
getMaxReconnectAttempts
public int getMaxReconnectAttempts()
-
setMaxReconnectAttempts
public void setMaxReconnectAttempts(int maxReconnectAttempts)
-
getMaxReconnectDelay
public long getMaxReconnectDelay()
-
setMaxReconnectDelay
public void setMaxReconnectDelay(long maxReconnectDelay)
-
isUseExponentialBackOff
public boolean isUseExponentialBackOff()
-
setUseExponentialBackOff
public void setUseExponentialBackOff(boolean useExponentialBackOff)
-
setGroup
public void setGroup(String group)
-
-