org.apache.activemq.transport.discovery.multicast
Class MulticastDiscoveryAgent

java.lang.Object
  extended by org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent
All Implemented Interfaces:
Runnable, Service, DiscoveryAgent

public class MulticastDiscoveryAgent
extends Object
implements DiscoveryAgent, Runnable

A DiscoveryAgent using a multicast address and heartbeat packets encoded using any wireformat, but openwire by default.


Field Summary
static String DEFAULT_DISCOVERY_URI_STRING
           
static String DEFAULT_HOST_IP
           
static String DEFAULT_HOST_STR
           
static int DEFAULT_PORT
           
 
Constructor Summary
MulticastDiscoveryAgent()
           
 
Method Summary
 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 service
 void 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 listener
 void setDiscoveryURI(URI discoveryURI)
          Set the discoveryURI
 void 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 agent
 void stop()
          stop the channel
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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
Constructor Detail

MulticastDiscoveryAgent

public MulticastDiscoveryAgent()
Method Detail

setDiscoveryListener

public void setDiscoveryListener(DiscoveryListener listener)
Set the discovery listener

Specified by:
setDiscoveryListener in interface DiscoveryAgent
Parameters:
listener -

registerService

public void registerService(String name)
                     throws IOException
register a service

Specified by:
registerService in interface DiscoveryAgent
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

Specified by:
start in interface Service
Throws:
Exception

stop

public void stop()
          throws Exception
stop the channel

Specified by:
stop in interface Service
Throws:
Exception

getType

public String getType()

run

public void run()
Specified by:
run in interface Runnable

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 interface DiscoveryAgent
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)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.