org.objectweb.tribe.gms.discovery
Class UdpDiscoveryService

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.objectweb.tribe.gms.discovery.UdpDiscoveryService
All Implemented Interfaces:
DiscoveryService, java.lang.Runnable

public class UdpDiscoveryService
extends java.lang.Thread
implements DiscoveryService

This class defines a UdpDiscoveryService.

GroupDiscoveryMessage are sent on the given multicast address. All registered listeners are called when a GroupDiscoveryMessage is received.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
UdpDiscoveryService(IpAddress multicastAddress, IpAddress replyAddress)
          Creates a new UdpDiscoveryService object
 
Method Summary
 IpAddress getReplyAddress()
          Returns the replyAddress value.
 void kill()
          Terminate the UdpDiscoveryService.
 void registerDiscoveryListener(DiscoveryListener listener)
          Register a new DiscoveryListener.
 void run()
          The DiscoveryService threads looks for JOIN messages and notify appropriate listeners.
 void sendGroupDiscovery(GroupIdentifier gid)
          Discover a group based on its identifier.
 void setReplyAddress(IpAddress replyAddress)
          Sets the replyAddress value.
 boolean unregisterDiscoveryListener(DiscoveryListener listener)
          Unregister a DiscoveryListener.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UdpDiscoveryService

public UdpDiscoveryService(IpAddress multicastAddress,
                           IpAddress replyAddress)
Creates a new UdpDiscoveryService object

Parameters:
multicastAddress - multicast address to use for discovery messages.
Method Detail

sendGroupDiscovery

public void sendGroupDiscovery(GroupIdentifier gid)
Description copied from interface: DiscoveryService
Discover a group based on its identifier.

Specified by:
sendGroupDiscovery in interface DiscoveryService
Parameters:
gid - group identifier
See Also:
DiscoveryService.sendGroupDiscovery(org.objectweb.tribe.common.GroupIdentifier)

registerDiscoveryListener

public void registerDiscoveryListener(DiscoveryListener listener)
Description copied from interface: DiscoveryService
Register a new DiscoveryListener.

Specified by:
registerDiscoveryListener in interface DiscoveryService
Parameters:
listener - the listener to add
See Also:
DiscoveryService.registerDiscoveryListener(org.objectweb.tribe.gms.discovery.DiscoveryListener)

unregisterDiscoveryListener

public boolean unregisterDiscoveryListener(DiscoveryListener listener)
Description copied from interface: DiscoveryService
Unregister a DiscoveryListener.

Specified by:
unregisterDiscoveryListener in interface DiscoveryService
Parameters:
listener - the listener to remove
Returns:
true if the listener was registered, false otherwise
See Also:
DiscoveryService.unregisterDiscoveryListener(org.objectweb.tribe.gms.discovery.DiscoveryListener)

run

public void run()
The DiscoveryService threads looks for JOIN messages and notify appropriate listeners.

Specified by:
run in interface java.lang.Runnable

getReplyAddress

public IpAddress getReplyAddress()
Returns the replyAddress value.

Returns:
Returns the replyAddress.

setReplyAddress

public void setReplyAddress(IpAddress replyAddress)
Sets the replyAddress value.

Parameters:
replyAddress - The replyAddress to set.

kill

public void kill()
Terminate the UdpDiscoveryService.



Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.