jgroup.core.arm
Interface ExecService

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
ExecDaemon

public interface ExecService
extends java.rmi.Remote

The ExecService interface describes the methods of an execution service that can be remotely invoked. Such an execution service can be used to start other java applications (replicas) on the remote machine on which the execution service is running.

Since:
Jgroup 1.2
Author:
Hein Meling

Field Summary
static java.lang.String EXEC_DAEMON_NAME
          Service name used to register each execution daemon in its local registry, or bootstrap registry.
static java.lang.String SHUTDOWN_REPLICA
          Keyword used to communicate to a replica that is should do a graceful shutdown.
 
Method Summary
 boolean createExecReplica(ClassData classData)
          Instantiate and start the given class (replica), within the same JVM as the execution service.
 boolean createReplica(ClassData classData)
          Instantiate and start the given class (replica) in a JVM process separate from the execution service JVM process.
 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.
 

Field Detail

EXEC_DAEMON_NAME

static final java.lang.String EXEC_DAEMON_NAME
Service name used to register each execution daemon in its local registry, or bootstrap registry.

See Also:
Constant Field Values

SHUTDOWN_REPLICA

static final java.lang.String SHUTDOWN_REPLICA
Keyword used to communicate to a replica that is should do a graceful shutdown.

See Also:
Constant Field Values
Method Detail

createExecReplica

boolean createExecReplica(ClassData classData)
                          throws java.rmi.RemoteException,
                                 ExecException
Instantiate and start the given class (replica), within the same JVM as the execution service. Be aware that starting a new replica in this way, may cause either the replica(s) or the execution service to crash due to the failure of only a single replica. Also, the use of System.exit() from such as replica will cause the JVM to exit. Thus, this approach should be used with causion.

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

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.

Parameters:
classData - The class data object representing the replica to start.
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.

removeReplica

boolean removeReplica(ClassData classData)
                      throws java.rmi.RemoteException
Remove the specified class (replica) from the execution service associated with the remote reference.

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

java.util.Set<ClassData> queryReplicas()
                                       throws java.rmi.RemoteException
Return the set of replicas currently running on this execution service.

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.

ping

void ping()
          throws java.rmi.RemoteException
Method used to check if the execution service is still running.

Throws:
java.rmi.RemoteException - If remote operation failed. This will indicate that the execution service is no longer running.

shutdown

void shutdown(int delay)
              throws java.rmi.RemoteException
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.

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.