jgroup.relacs.daemon
Class Daemon

java.lang.Object
  extended by jgroup.relacs.daemon.Daemon
All Implemented Interfaces:
java.rmi.Remote, DaemonService, EventTags, MssConstants, MssUser

public final class Daemon
extends java.lang.Object
implements DaemonService, MssUser, EventTags, MssConstants

The Daemon is the access interface for the group membership service and reliable multicast service.

Since:
Jgroup 0.1
Author:
Alberto Montresor, Hein Meling, Marcin Solarski

Field Summary
static byte R_ACK
           
static byte R_ESTIM
           
static java.lang.String[] R_ExTAGS
           
static byte R_FORWARD
           
static byte R_INTEREST
           
static byte R_JOIN
           
static byte R_JOINACK
           
static byte R_LEAVE
           
static byte R_MCAST
           
static byte R_NOGID
           
static byte R_NOINTEREST
           
static byte R_PROP
           
static byte R_RESULT
           
static byte R_SYMM
           
static byte R_SYNCH
           
static java.lang.String[] R_TAGS
           
static byte R_VIEW
           
static int S_ESTIMATE
           
static int S_IDLE
           
static int S_SYNCH
           
 
Fields inherited from interface jgroup.relacs.daemon.DaemonService
DAEMON_NAME
 
Fields inherited from interface jgroup.relacs.events.EventTags
DAEMON_FAILURE_EVENT, DELIVERY_ACK, DELIVERY_EVENT, INSTALL_ACK, INSTALL_EVENT, JOIN_REQUEST, LEAVE_REQUEST, MEMBER_LEFT_EVENT, MULTICAST_REQUEST, PREPARE_ACK, PREPARE_EVENT
 
Fields inherited from interface jgroup.relacs.mss.MssConstants
ALL, EHANDLER_PRIORITY, HEADER_SIZE, MINIMUM_ALIVE_VALUE, MSS_HEADER_SIZE, MSSUSER_PRIORITY, NACKSUPPRESSION, NI_PRIORITY, OVERHEAD_SIZE, ROUTING_ENABLED, TRAILER_SIZE, UNDEF, UNREACHABLE
 
Method Summary
 void addEvent(Event event)
          Adds an event generated by a member to the local queue of events.
static void bindLocalDaemon(DaemonService daemonService)
           
static Daemon createDaemon(TransportConfig conf)
          Create a daemon object on the local host.
 MemberId getMemberId(EndPoint localEndPoint)
          Returns a new member id for a new member.
 void localReceive(Event event)
          Handles a message received by a local member.
 void localSuspect(MemberId memberId)
          Invoked to notify the objects implementing this interface that a remote object is not responding to remote method invocations, and thus should be crashed.
static DaemonService lookupLocalDaemon()
          Obtain a remote reference for a local daemon.
 int members()
          Returns the number of members associated with this Jgroup daemon.
static DaemonService quickLookupLocalDaemon()
          Lookup a local daemon without retrying.
 void remoteReceive(byte tag, InMessage stream, EndPoint src)
          Handles a message received from a remote host.
 void remoteSuspect(EndPoint[] trset, EndPoint[] nrset, EndPoint[] nuset, EndPoint[] newinc)
          Handles variations in the mss-reachability
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S_IDLE

public static final int S_IDLE
See Also:
Constant Field Values

S_SYNCH

public static final int S_SYNCH
See Also:
Constant Field Values

S_ESTIMATE

public static final int S_ESTIMATE
See Also:
Constant Field Values

R_MCAST

public static final byte R_MCAST
See Also:
Constant Field Values

R_ACK

public static final byte R_ACK
See Also:
Constant Field Values

R_ESTIM

public static final byte R_ESTIM
See Also:
Constant Field Values

R_FORWARD

public static final byte R_FORWARD
See Also:
Constant Field Values

R_SYNCH

public static final byte R_SYNCH
See Also:
Constant Field Values

R_SYMM

public static final byte R_SYMM
See Also:
Constant Field Values

R_PROP

public static final byte R_PROP
See Also:
Constant Field Values

R_VIEW

public static final byte R_VIEW
See Also:
Constant Field Values

R_RESULT

public static final byte R_RESULT
See Also:
Constant Field Values

R_NOGID

public static final byte R_NOGID
See Also:
Constant Field Values

R_INTEREST

public static final byte R_INTEREST
See Also:
Constant Field Values

R_NOINTEREST

public static final byte R_NOINTEREST
See Also:
Constant Field Values

R_LEAVE

public static final byte R_LEAVE
See Also:
Constant Field Values

R_JOIN

public static final byte R_JOIN
See Also:
Constant Field Values

R_JOINACK

public static final byte R_JOINACK
See Also:
Constant Field Values

R_TAGS

public static final java.lang.String[] R_TAGS

R_ExTAGS

public static final java.lang.String[] R_ExTAGS
Method Detail

createDaemon

public static Daemon createDaemon(TransportConfig conf)
                           throws ConfigurationException,
                                  java.io.IOException
Create a daemon object on the local host.

Parameters:
conf - Transport configuration parameters
Returns:
A daemon instance.
Throws:
java.io.IOException - Raised if a daemon could not be created due to a problem with port initialization. Another application (or daemon) may be using our socket port.
ConfigurationException - Raised if a daemon could not be created due to a misconfiguration.

bindLocalDaemon

public static void bindLocalDaemon(DaemonService daemonService)
                            throws JgroupException
Throws:
JgroupException

lookupLocalDaemon

public static DaemonService lookupLocalDaemon()
                                       throws JgroupException
Obtain a remote reference for a local daemon.

This method can be invoked if we are unable to bind a daemon instance to the port specifed in the distributed system configuration. This may occur on two occasions; (i) there is another daemon running on the local host, or (ii) some other application is using the specified port. The former case may also occur before the other daemon has managed to register its reference in the bootstrap registry, thus we need to retry a few times before concluding that it is some other application.

Returns:
The remote DaemonService object
Throws:
JgroupException - Raised if no daemon could be found (e.g., not stored in the registry).

quickLookupLocalDaemon

public static DaemonService quickLookupLocalDaemon()
Lookup a local daemon without retrying.


getMemberId

public MemberId getMemberId(EndPoint localEndPoint)
                     throws java.rmi.RemoteException
Returns a new member id for a new member. The new member id is obtained by concatenating the endpoint of this daemon, the incarnation number used to distinguish different incarnation of the same endpoint, and a sequence number used to distinguish different members.

Specified by:
getMemberId in interface DaemonService
Throws:
java.rmi.RemoteException

members

public int members()
            throws java.rmi.RemoteException
Returns the number of members associated with this Jgroup daemon.

Specified by:
members in interface DaemonService
Throws:
java.rmi.RemoteException

addEvent

public void addEvent(Event event)
              throws java.rmi.RemoteException
Adds an event generated by a member to the local queue of events.

Specified by:
addEvent in interface DaemonService
Throws:
java.rmi.RemoteException

remoteReceive

public void remoteReceive(byte tag,
                          InMessage stream,
                          EndPoint src)
Handles a message received from a remote host.

Specified by:
remoteReceive in interface MssUser
Parameters:
tag - the tag identifying the type of message
stream - the message, represented by a InMessage object
src - the sender of the message

localReceive

public void localReceive(Event event)
Handles a message received by a local member.

Specified by:
localReceive in interface MssUser
Parameters:
event - represents the received message

remoteSuspect

public void remoteSuspect(EndPoint[] trset,
                          EndPoint[] nrset,
                          EndPoint[] nuset,
                          EndPoint[] newinc)
Handles variations in the mss-reachability

Specified by:
remoteSuspect in interface MssUser
Parameters:
trset - set of all (total) reachable hosts
nrset - set of reachable hosts that were unreachable
nuset - set of unreachable hosts that were reachable
newinc - set of hosts who has a new incarnation identifier

localSuspect

public void localSuspect(MemberId memberId)
Invoked to notify the objects implementing this interface that a remote object is not responding to remote method invocations, and thus should be crashed.

Specified by:
localSuspect in interface MssUser
Parameters:
memberId - a callback object identifying the suspected object; this object has been stored in the Mss through the addPingListener invocation on the Mss.


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.