jgroup.arm
Class ExecDaemon

java.lang.Object
  extended by jgroup.arm.ExecDaemon
All Implemented Interfaces:
java.rmi.Remote, ExecService

public class ExecDaemon
extends java.lang.Object
implements ExecService

ExecDaemon implements the ExecService allowing a replica manager or other entity to start replicas on hosts running the ExecDaemon. Note that an important property of ExecDaemon is that it does not have any state (except the map of local processes). Thus the rest of the distributed system does not depend on its state.

Since:
Jgroup 1.2
Author:
Hein Meling

Field Summary
 
Fields inherited from interface jgroup.core.arm.ExecService
EXEC_DAEMON_NAME, SHUTDOWN_REPLICA
 
Constructor Summary
ExecDaemon()
           
 
Method Summary
 boolean createExecReplica(ClassData classData)
          Comments inherited from jgroup.arm.ExecService
 boolean createReplica(ClassData classData)
          Instantiate and start the given class (replica) in a JVM process separate from the execution service JVM process.
static void main(java.lang.String[] argv)
           
 void ping()
          Method used to check if the execution service is still running.
 java.util.Set<ClassData> queryReplicas()
          Return the set of replicas currently running on this execution service.
 boolean removeReplica(ClassData classData)
          Remove the specified class (replica) from the execution service associated with the remote reference.
 void shutdown(int delay)
          Request the execution service on this particular host to shutdown in approximately delay milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecDaemon

public ExecDaemon()
           throws java.rmi.RemoteException,
                  JgroupException,
                  ConfigurationException
Throws:
java.rmi.RemoteException
JgroupException
ConfigurationException
Method Detail

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Throws:
java.lang.Exception

createExecReplica

public boolean createExecReplica(ClassData classData)
                          throws java.rmi.RemoteException,
                                 ExecException
Comments inherited from jgroup.arm.ExecService

Specified by:
createExecReplica in interface ExecService
Parameters:
classData - The class data object representing the replica to start. The specified class must implement the remove method.
Returns:
False if the replica already exists on the associated execution service; true is returned if the replica was created.
Throws:
java.rmi.RemoteException - If remote operation failed.
ExecException - If the specified class (replica) could not be instantiated or if the class (replica) does not implement the remove method.

createReplica

public boolean createReplica(ClassData classData)
                      throws java.rmi.RemoteException,
                             ExecException
Instantiate and start the given class (replica) in a JVM process separate from the execution service JVM process. Creates a new replica in a seperate JVM process. Only one replica for each matching ClassData object (or group) can be started on each host. This makes the operation idempotent, allowing several replication managers to invoke the same create operation on the same host as another replication manager already may have done. This prevents creating multiple instances of the same class with identical arguments. Thus, different arguments are not considered the same instance.

Specified by:
createReplica in interface ExecService
Parameters:
classData - The class data object representing the replica to start.
Returns:
True if the replica was created; false is returned if the replica is already running on this host.
Throws:
java.rmi.RemoteException - If remote operation failed.
ExecException - If the specified class (replica) could not be instantiated.

removeReplica

public boolean removeReplica(ClassData classData)
                      throws java.rmi.RemoteException
Description copied from interface: ExecService
Remove the specified class (replica) from the execution service associated with the remote reference.

Specified by:
removeReplica in interface ExecService
Parameters:
classData - The class data object representing the replica to start.
Returns:
False if the specified class (replica) could not be found on the associated execution service; true if the replica was successfully removed.
Throws:
java.rmi.RemoteException - If remote operation failed.

queryReplicas

public java.util.Set<ClassData> queryReplicas()
                                       throws java.rmi.RemoteException
Description copied from interface: ExecService
Return the set of replicas currently running on this execution service.

Specified by:
queryReplicas in interface ExecService
Returns:
The set of class data objects representing replicas that is currently running within this ExecService instance.
Throws:
java.rmi.RemoteException - If remote operation failed.
See Also:
ExecService.queryReplicas()

ping

public void ping()
          throws java.rmi.RemoteException
Description copied from interface: ExecService
Method used to check if the execution service is still running.

Specified by:
ping in interface ExecService
Throws:
java.rmi.RemoteException - If remote operation failed. This will indicate that the execution service is no longer running.
See Also:
ExecService.ping()

shutdown

public void shutdown(int delay)
              throws java.rmi.RemoteException
Description copied from interface: ExecService
Request the execution service on this particular host to shutdown in approximately delay milliseconds. If delay is negative all local replicas are removed, and shutdown will be immediate and no shutdown hooks are executed. If the delay is positive, shutdown hooks will be executed during the shutdown sequence.

Specified by:
shutdown in interface ExecService
Parameters:
delay - The delay to wait before initiating shutdown.
Throws:
java.rmi.RemoteException - If remote operation failed. This will indicate that the execution service is no longer running.


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