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
ADiscoveryAgent
using a multicast address and heartbeat packets encoded using any wireformat, but openwire by default.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_DISCOVERY_URI_STRING
static String
DEFAULT_HOST_IP
static String
DEFAULT_HOST_STR
static int
DEFAULT_PORT
-
Constructor Summary
Constructors Constructor Description MulticastDiscoveryAgent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getBackOffMultiplier()
URI
getDiscoveryURI()
long
getInitialReconnectDelay()
long
getKeepAliveInterval()
int
getMaxReconnectAttempts()
long
getMaxReconnectDelay()
int
getTimeToLive()
String
getType()
boolean
isLoopBackMode()
boolean
isUseExponentialBackOff()
void
registerService(String name)
register a servicevoid
run()
void
serviceFailed(DiscoveryEvent event)
A process actively using a service may see it go down before the DiscoveryAgent notices the service's failure.void
setBackOffMultiplier(long backOffMultiplier)
void
setDiscoveryListener(DiscoveryListener listener)
Set the discovery listenervoid
setDiscoveryURI(URI discoveryURI)
Set the discoveryURIvoid
setGroup(String group)
void
setInitialReconnectDelay(long initialReconnectDelay)
void
setInterface(String mcInterface)
void
setJoinNetworkInterface(String mcJoinNetwrokInterface)
void
setKeepAliveInterval(long keepAliveInterval)
void
setLoopBackMode(boolean loopBackMode)
void
setMaxReconnectAttempts(int maxReconnectAttempts)
void
setMaxReconnectDelay(long maxReconnectDelay)
void
setNetworkInterface(String mcNetworkInterface)
void
setTimeToLive(int timeToLive)
void
setUseExponentialBackOff(boolean useExponentialBackOff)
void
start()
start the discovery agentvoid
stop()
stop the channelString
toString()
-
-
-
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:
setDiscoveryListener
in interfaceDiscoveryAgent
- Parameters:
listener
-
-
registerService
public void registerService(String name) throws IOException
register a service- Specified by:
registerService
in 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 Exception
start the discovery agent
-
stop
public void stop() throws Exception
stop the channel
-
getType
public String getType()
-
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
-
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)
-
-