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

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

public class MulticastDiscoveryAgent
extends java.lang.Object
implements DiscoveryAgent, java.lang.Runnable

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

Version:
$Revision$

Field Summary
static java.lang.String DEFAULT_DISCOVERY_URI_STRING
           
 
Constructor Summary
MulticastDiscoveryAgent()
           
 
Method Summary
 java.lang.String getBrokerName()
           
 java.net.URI getDiscoveryURI()
           
 java.lang.String getGroup()
          Get the group used for discovery
 long getKeepAliveInterval()
           
 int getTimeToLive()
           
 java.lang.String getType()
           
 boolean isLoopBackMode()
           
 void registerService(java.lang.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 setBrokerName(java.lang.String brokerName)
           
 void setDiscoveryListener(DiscoveryListener listener)
          Set the discovery listener
 void setDiscoveryURI(java.net.URI discoveryURI)
          Set the discoveryURI
 void setGroup(java.lang.String group)
          Set the group for discovery
 void setKeepAliveInterval(long keepAliveInterval)
           
 void setLoopBackMode(boolean loopBackMode)
           
 void setTimeToLive(int timeToLive)
           
 void start()
          start the discovery agent
 void stop()
          stop the channel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DISCOVERY_URI_STRING

public static final java.lang.String DEFAULT_DISCOVERY_URI_STRING
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(java.lang.String name)
                     throws java.io.IOException
register a service

Specified by:
registerService in interface DiscoveryAgent
Throws:
java.io.IOException

getGroup

public java.lang.String getGroup()
Get the group used for discovery

Specified by:
getGroup in interface DiscoveryAgent
Returns:
the group

setGroup

public void setGroup(java.lang.String group)
Set the group for discovery

Specified by:
setGroup in interface DiscoveryAgent
Parameters:
group -

getBrokerName

public java.lang.String getBrokerName()
Returns:
Returns the brokerName.

setBrokerName

public void setBrokerName(java.lang.String brokerName)
Specified by:
setBrokerName in interface DiscoveryAgent
Parameters:
brokerName - The brokerName to set.

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 java.net.URI getDiscoveryURI()
Returns:
the discoveryURI

setDiscoveryURI

public void setDiscoveryURI(java.net.URI discoveryURI)
Set the discoveryURI

Parameters:
discoveryURI -

getKeepAliveInterval

public long getKeepAliveInterval()

setKeepAliveInterval

public void setKeepAliveInterval(long keepAliveInterval)

start

public void start()
           throws java.lang.Exception
start the discovery agent

Specified by:
start in interface Service
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
stop the channel

Specified by:
stop in interface Service
Throws:
java.lang.Exception

getType

public java.lang.String getType()

run

public void run()
Specified by:
run in interface java.lang.Runnable

serviceFailed

public void serviceFailed(DiscoveryEvent event)
                   throws java.io.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:
java.io.IOException


Copyright © 2011 Apache Software Foundation. All Rights Reserved.