jgroup.relacs.daemon
Class DaemonInteraction

java.lang.Object
  extended by jgroup.relacs.daemon.DaemonInteraction

public class DaemonInteraction
extends java.lang.Object

The DaemonInteraction class facilitate a common interaction point between the daemon and group managers. Its main purpose is to provide common error handling.

Since:
Jgroup 1.2
Author:
Hein Meling

Constructor Summary
DaemonInteraction()
           
 
Method Summary
static boolean addEvent(Event event)
          Adds an event generated by a member to the daemon's event queue.
static boolean addEvent(jgroup.relacs.daemon.MemberData member, Event event)
          Adds an event generated by the daemon to given (local) member's event queue.
static MemberId getMemberId()
          Returns a MemberId for a new member.
static boolean handleDaemonFailure()
          Handle daemon-member interaction failures.
static void initDaemon()
          Initialize the Jgroup daemon, according to the specified number of daemons that should exist in this domain.
static boolean suspectDaemon()
          Method used to indicate that the daemon has not responded within some predefined timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DaemonInteraction

public DaemonInteraction()
Method Detail

initDaemon

public static void initDaemon()
                       throws JgroupException
Initialize the Jgroup daemon, according to the specified number of daemons that should exist in this domain.

Throws:
JgroupException

getMemberId

public static MemberId getMemberId()
                            throws JgroupException
Returns a MemberId for a new member. The new identifier 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 running on the same host (different JVMs).

Throws:
JgroupException - Raised if we could not obtain a member identifier due to communication problems with the daemon.

addEvent

public static boolean addEvent(Event event)
Adds an event generated by a member to the daemon's event queue.

Returns:
True if the event was successfully added; false is returned if the daemon has crashed, and not recovered.

addEvent

public static boolean addEvent(jgroup.relacs.daemon.MemberData member,
                               Event event)
Adds an event generated by the daemon to given (local) member's event queue.

Parameters:
member - The recipient member (Dispatcher) of this event.
event - The event to be added to the given member's event queue.
Returns:
True if communication is ok; false otherwise.

handleDaemonFailure

public static boolean handleDaemonFailure()
Handle daemon-member interaction failures.

If the system property 'jgroup.daemon.recover.locally' is true, and there is a confirmed daemon crash, local recovery is performed. Otherwise, this member will commit suicide.

Returns:
True is returned if a new daemon was successfully initialized.

suspectDaemon

public static boolean suspectDaemon()
Method used to indicate that the daemon has not responded within some predefined timeout. Here we try to recover by installing a new daemon locally.

Returns:
true if the daemon is not responding, false otherwise.


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