org.objectweb.proactive
Class ProActive

java.lang.Object
  |
  +--org.objectweb.proactive.ProActive

public class ProActive
extends java.lang.Object


Field Summary
static java.util.HashMap codeLevel
          Code level is used for temporary handlers
static java.util.HashMap defaultLevel
          This level is used for default handlers
protected static org.apache.log4j.Logger logger
           
static java.util.HashMap VMLevel
          VM level provides different strategies according to the virtual machine
 
Method Summary
static void disableAC(java.lang.Object obj)
          Disable the automatic continuation mechanism for this active object.
static void enableAC(java.lang.Object obj)
          Enable the automatic continuation mechanism for this active object.
static Body getBodyOnThis()
          When an active object is created, it is associated with a Body that takes care of all non fonctionnal properties.
static java.lang.Object getFutureValue(java.lang.Object future)
          Return the object contains by the future (ie its target).
static java.lang.String getJobId()
           
static ProActiveDescriptor getProactiveDescriptor(java.lang.String xmlDescriptorUrl)
          Returns a ProActiveDescriptor that gives an object representation of the XML document located at the given url.
static StubObject getStubOnThis()
          Returns a Stub-Proxy couple pointing to the local body associated to the active object whose active thread is calling this method.
static boolean isAwaited(java.lang.Object future)
          Return false if the object future is available.
static java.lang.Object lookupActive(java.lang.String classname, java.lang.String url)
          Looks-up an active object previously registered in a RMI registry.
static VirtualNode lookupVirtualNode(java.lang.String url, java.lang.String protocol)
          Looks-up a VirtualNode previously registered in a registry(RMI or JINI)
static void migrateTo(Body bodyToMigrate, Node node, boolean priority)
          Migrates the body bodyToMigrate to the given node.
static void migrateTo(Body bodyToMigrate, java.lang.Object activeObject, boolean priority)
          Migrates the given body to the same location as the active object given in parameter.
static void migrateTo(Body bodyToMigrate, java.lang.String nodeURL, boolean priority)
          Migrates the given body to the node caracterized by the given url.
static void migrateTo(Node node)
          Migrates the active object whose active thread is calling this method to the given node.
static void migrateTo(java.lang.Object activeObject)
          Migrates the active object whose active thread is calling this method to the same location as the active object given in parameter.
static void migrateTo(java.lang.String nodeURL)
          Migrates the active object whose active thread is calling this method to the node caracterized by the given url.
static java.lang.Object newActive(java.lang.String classname, java.lang.Object[] constructorParameters)
          Creates a new ActiveObject based on classname attached to a default node in the local JVM.
static java.lang.Object newActive(java.lang.String classname, java.lang.Object[] constructorParameters, Node node)
          Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null.
static java.lang.Object newActive(java.lang.String classname, java.lang.Object[] constructorParameters, Node node, Active activity, MetaObjectFactory factory)
          Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null.
static java.lang.Object newActive(java.lang.String classname, java.lang.Object[] constructorParameters, java.lang.String nodeURL)
          Creates a new ActiveObject based on classname attached to the node of the given URL.
static java.lang.Object newActive(java.lang.String classname, java.lang.Object[] constructorParameters, VirtualNode virtualnode)
          Creates a new set of active objects based on classname attached to the given virtualnode.
static java.lang.Object newActive(java.lang.String classname, java.lang.Object[] constructorParameters, VirtualNode virtualnode, Active activity, MetaObjectFactory factory)
          Creates a new ActiveObject based on classname attached to the given virtualnode.
static Component newActiveComponent(java.lang.String classname, java.lang.Object[] constructorParameters, Node node, Active activity, MetaObjectFactory factory, ComponentParameters componentParameters)
          Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component.
static Component newActiveComponent(java.lang.String className, java.lang.Object[] constructorParameters, VirtualNode vn, ComponentParameters componentParameters)
          Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component.
static void register(java.lang.Object obj, java.lang.String url)
          Registers an active object into a RMI registry.
static void registerVirtualNode(VirtualNode virtualNode, java.lang.String registrationProtocol, boolean replacePreviousBinding)
          Registers locally the given VirtualNode in a registry such RMIRegistry or JINI Lookup Service.
static IHandler searchExceptionHandler(NonFunctionalException ex)
          Search an appropriate handler for a given non functional exception.
static IHandler searchExceptionHandler(NonFunctionalException ex, java.util.HashMap level, int levelID)
          Search an appropriate handler for a given non functional exception.
static void setExceptionHandler(int ID_level, java.lang.Object obj, java.lang.Class hName, java.lang.Class exName)
          Add a new handler to a specific level.
static void setImmediateService(java.lang.Object obj, java.lang.String methodName)
          Set an immmediate execution for the active object obj, ie request of name methodName will be executed by the calling thread, and not add in the request queue.
static java.lang.Object turnActive(java.lang.Object target)
          Turns the target object into an ActiveObject attached to a default node in the local JVM.
static java.lang.Object turnActive(java.lang.Object target, Node node)
          Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, Node node, Active activity, MetaObjectFactory factory)
          Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, java.lang.String nodeURL)
          Turns the target object into an Active Object and send it to the Node identified by the given url.
static java.lang.Object turnActive(java.lang.Object target, java.lang.String nameOfTargetType, Node node)
          Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, java.lang.String nameOfTargetType, Node node, Active activity, MetaObjectFactory factory)
          Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null.
static java.lang.Object turnActive(java.lang.Object target, java.lang.String nameOfTargetType, VirtualNode virtualnode)
          Turns a Java object into an Active Object and send it to remote Nodes mapped to the given virtualnode in the XML deployment descriptor.
static void unregister(java.lang.String url)
          Unregisters an active object previously registered into a RMI registry.
static void unregisterVirtualNode(VirtualNode virtualNode)
          Unregisters the virtualNode previoulsy registered in a registry such as JINI or RMI.
static IHandler unsetExceptionHandler(int ID_level, java.lang.Object obj, java.lang.Class exName)
          Remove the handler associated to a non functional exception.
static void waitFor(java.lang.Object future)
          Blocks the calling thread until the object future is available.
static void waitForAll(java.util.Vector futures)
          Blocks the calling thread until all futures in the vector are available.
static int waitForAny(java.util.Vector futures)
          Blocks the calling thread until one of the futures in the vector is available.
static void waitForTheNth(java.util.Vector futures, int n)
          Blocks the calling thread until the N-th of the futures in the vector is available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.log4j.Logger logger

defaultLevel

public static java.util.HashMap defaultLevel
This level is used for default handlers


VMLevel

public static java.util.HashMap VMLevel
VM level provides different strategies according to the virtual machine


codeLevel

public static java.util.HashMap codeLevel
Code level is used for temporary handlers

Method Detail

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Object[] constructorParameters)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to a default node in the local JVM.

Parameters:
classname - the name of the class to instanciate as active
constructorParameters - the parameters of the constructor.
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the DefaultNode cannot be created

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Object[] constructorParameters,
                                         java.lang.String nodeURL)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to the node of the given URL.

Parameters:
classname - the name of the class to instanciate as active
constructorParameters - the parameters of the constructor.
nodeURL - the URL of the node where to create the active object. If null, the active object is created localy on a default node
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node URL cannot be resolved as an existing Node

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Object[] constructorParameters,
                                         Node node)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null.

Parameters:
classname - the name of the class to instanciate as active
constructorParameters - the parameters of the constructor.
node - the possibly null node where to create the active object.
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Object[] constructorParameters,
                                         Node node,
                                         Active activity,
                                         MetaObjectFactory factory)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to the given node or on a default node in the local JVM if the given node is null. The object returned is a stub class that extends the target class and that is automatically generated on the fly. The Stub class reference a the proxy object that reference the body of the active object. The body referenced by the proxy can either be local of remote, depending or the respective location of the object calling the newActive and the active object itself.

Parameters:
classname - the name of the class to instanciate as active
constructorParameters - the parameters of the constructor of the object to instantiate as active. If some parameters are primitive types, the wrapper class types should be given here. null can be used to specify that no parameter are passed to the constructor.
node - the possibly null node where to create the active object. If null, the active object is created localy on a default node
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
a reference (possibly remote) on a Stub of the newly created active object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Object[] constructorParameters,
                                         VirtualNode virtualnode)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new set of active objects based on classname attached to the given virtualnode.

Parameters:
classname - classname the name of the class to instanciate as active
constructorParameters - constructorParameters the parameters of the constructor.
virtualnode - The virtualnode where to create active objects. Active objects will be created on each node mapped to the given virtualnode in XML deployment descriptor.
Returns:
Object a Group of references (possibly remote) on Stub of newly created active objects
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the virtualnode was null

newActive

public static java.lang.Object newActive(java.lang.String classname,
                                         java.lang.Object[] constructorParameters,
                                         VirtualNode virtualnode,
                                         Active activity,
                                         MetaObjectFactory factory)
                                  throws ActiveObjectCreationException,
                                         NodeException
Creates a new ActiveObject based on classname attached to the given virtualnode.

Parameters:
classname - classname the name of the class to instanciate as active
constructorParameters - constructorParameters the parameters of the constructor.
virtualnode - The virtualnode where to create active objects. Active objects will be created on each node mapped to the given virtualnode in XML deployment descriptor.
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
Object a Group of references (possibly remote) on Stub of newly created active objects
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the virtualnode was null

newActiveComponent

public static Component newActiveComponent(java.lang.String classname,
                                           java.lang.Object[] constructorParameters,
                                           Node node,
                                           Active activity,
                                           MetaObjectFactory factory,
                                           ComponentParameters componentParameters)
                                    throws ActiveObjectCreationException,
                                           NodeException
Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component. A reference on the active object base class can be retreived through the component parameters controller's method "getStubOnReifiedObject".

Parameters:
classname - the name of the base class. "Composite" if the component is a composite, "ParallelComposite" if the component is a parallel composite component
constructorParameters - the parameters of the constructor of the object to instantiate as active. If some parameters are primitive types, the wrapper class types should be given here. null can be used to specify that no parameter are passed to the constructor.
node - the possibly null node where to create the active object. If null, the active object is created localy on a default node
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - should be null for components (automatically created)
componentParameters - the parameters of the component
Returns:
a component representative of type Component
Throws:
ActiveObjectCreationException - if a problem occurs while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

newActiveComponent

public static Component newActiveComponent(java.lang.String className,
                                           java.lang.Object[] constructorParameters,
                                           VirtualNode vn,
                                           ComponentParameters componentParameters)
                                    throws ActiveObjectCreationException,
                                           NodeException
Creates a new ProActive component over the specified base class, according to the given component parameters, and returns a reference on the component of type Component. This method allows automatic of primitive components on Virtual Nodes. In that case, the appendix -cyclicInstanceNumber-number is added to the name of each of these components. If the component is not a primitive, only one instance of the component is created, on the first node retreived from the specified virtual node. A reference on the active object base class can be retreived through the component parameters controller's method "getStubOnReifiedObject".

Parameters:
constructorParameters - the parameters of the constructor of the object to instantiate as active. If some parameters are primitive types, the wrapper class types should be given here. null can be used to specify that no parameter are passed to the constructor.
componentParameters - the parameters of the component
Returns:
a typed group of component representative elements, of type Component
Throws:
ActiveObjectCreationException - if a problem occurs while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an ActiveObject attached to a default node in the local JVM. The type of the stub is is the type of the existing object.

Parameters:
target - The object to turn active
Returns:
a reference (possibly remote) on a Stub of the existing object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.String nodeURL)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an Active Object and send it to the Node identified by the given url. The type of the stub is is the type of the existing object.

Parameters:
target - The object to turn active
nodeURL - the URL of the node where to create the active object on. If null, the active object is created localy on a default node
Returns:
a reference (possibly remote) on a Stub of the existing object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          Node node)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null. The type of the stub is is the type of the target object.

Parameters:
target - The object to turn active
node - The Node the object should be sent to or null to create the active object in the local JVM
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          Node node,
                                          Active activity,
                                          MetaObjectFactory factory)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns the target object into an Active Object and send it to the given Node or to a default node in the local JVM if the given node is null. The type of the stub is is the type of the target object.

Parameters:
target - The object to turn active
node - The Node the object should be sent to or null to create the active object in the local JVM
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.String nameOfTargetType,
                                          Node node)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null. The type of the stub is given by the parameter nameOfTargetType.

Parameters:
target - The object to turn active
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
node - The Node the object should be sent to or null to create the active object in the local JVM
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.String nameOfTargetType,
                                          Node node,
                                          Active activity,
                                          MetaObjectFactory factory)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns a Java object into an Active Object and send it to a remote Node or to a local node if the given node is null. The type of the stub is given by the parameter nameOfTargetType. A Stub is dynamically generated for the existing object. The result of the call will be an instance of the Stub class pointing to the proxy object pointing to the body object pointing to the existing object. The body can be remote or local depending if the existing is sent remotely or not.

Parameters:
target - The object to turn active
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
node - The Node the object should be sent to or null to create the active object in the local JVM
activity - the possibly null activity object defining the different step in the activity of the object. see the definition of the activity in the javadoc of this classe for more information.
factory - the possibly null meta factory giving all factories for creating the meta-objects part of the body associated to the reified object. If null the default ProActive MataObject factory is used.
Returns:
a reference (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

turnActive

public static java.lang.Object turnActive(java.lang.Object target,
                                          java.lang.String nameOfTargetType,
                                          VirtualNode virtualnode)
                                   throws ActiveObjectCreationException,
                                          NodeException
Turns a Java object into an Active Object and send it to remote Nodes mapped to the given virtualnode in the XML deployment descriptor. The type of the stub is given by the parameter nameOfTargetType.

Parameters:
target - The object to turn active
nameOfTargetType - the fully qualified name of the type the stub class should inherit from. That type can be less specific than the type of the target object.
virtualnode - The VirtualNode where the target object will be turn into an Active Object Target object will be turned into an Active Object on each node mapped to the given virtualnode in XML deployment descriptor.
Returns:
an array of references (possibly remote) on a Stub of the target object
Throws:
ActiveObjectCreationException - if a problem occur while creating the stub or the body
NodeException - if the node was null and that the DefaultNode cannot be created

register

public static void register(java.lang.Object obj,
                            java.lang.String url)
                     throws java.io.IOException
Registers an active object into a RMI registry. In fact it is the remote version of the body of the active object that is registered into the RMI Registry under the given URL.

Parameters:
obj - the active object to register.
url - the url under which the remote body is registered.
Throws:
java.io.IOException - if the remote body cannot be registered

unregister

public static void unregister(java.lang.String url)
                       throws java.io.IOException
Unregisters an active object previously registered into a RMI registry.

Parameters:
url - the url under which the active object is registered.
Throws:
java.io.IOException - if the remote object cannot be removed from the registry

lookupActive

public static java.lang.Object lookupActive(java.lang.String classname,
                                            java.lang.String url)
                                     throws ActiveObjectCreationException,
                                            java.io.IOException
Looks-up an active object previously registered in a RMI registry. In fact it is the remote version of the body of an active object that can be registered into the RMI Registry under a given URL. If the lookup is successful, the method reconstructs a Stub-Proxy couple and point it to the RemoteBody found.

Parameters:
classname - the fully qualified name of the class the stub should inherit from.
url - the url under which the remote body is registered.
Returns:
a remote reference on a Stub of type classname pointing to the remote body found
Throws:
java.io.IOException - if the remote body cannot be found under the given url or if the object found is not of type RemoteBody
ActiveObjectCreationException - if the stub-proxy couple cannot be created

waitFor

public static void waitFor(java.lang.Object future)
Blocks the calling thread until the object future is available. future must be the result object of an asynchronous call. Usually the the wait by necessity model take care of blocking the caller thread asking for a result not yet available. This method allows to block before the result is first used.


getProactiveDescriptor

public static ProActiveDescriptor getProactiveDescriptor(java.lang.String xmlDescriptorUrl)
                                                  throws ProActiveException
Returns a ProActiveDescriptor that gives an object representation of the XML document located at the given url.

Returns:
ProActiveDescriptor. The object representation of the XML document
Throws:
ProActiveException - if a problem occurs during the creation of the object
See Also:
ProActiveDescriptor, VirtualNode, VirtualMachine

registerVirtualNode

public static void registerVirtualNode(VirtualNode virtualNode,
                                       java.lang.String registrationProtocol,
                                       boolean replacePreviousBinding)
                                throws ProActiveException
Registers locally the given VirtualNode in a registry such RMIRegistry or JINI Lookup Service. The VirtualNode to register must exist on the local runtime. This is done when using XML Deployment Descriptors

Parameters:
virtualNode - the VirtualNode to register.
registrationProtocol - The protocol used for registration. At this time RMI and JINI are supported
replacePreviousBinding -
Throws:
ProActiveException - If the VirtualNode with the given name does not exist on the local runtime

lookupVirtualNode

public static VirtualNode lookupVirtualNode(java.lang.String url,
                                            java.lang.String protocol)
                                     throws ProActiveException
Looks-up a VirtualNode previously registered in a registry(RMI or JINI)

Parameters:
url - The url where to perform the lookup
protocol - The protocol used to perform the lookup(RMI and JINI are supported)
Returns:
VirtualNode The virtualNode returned by the lookup
Throws:
ProActiveException - If no objects are bound with the given url

unregisterVirtualNode

public static void unregisterVirtualNode(VirtualNode virtualNode)
                                  throws ProActiveException
Unregisters the virtualNode previoulsy registered in a registry such as JINI or RMI. Calling this method removes the VirtualNode from the local runtime.

Parameters:
virtualNode - The VirtualNode to unregister
Throws:
ProActiveException - if a problem occurs whle unregistering the VirtualNode

getBodyOnThis

public static Body getBodyOnThis()
When an active object is created, it is associated with a Body that takes care of all non fonctionnal properties. Assuming that the active object is only accessed by the different Stub objects, all method calls end-up as Requests sent to this Body. Therefore the only thread calling the method of the active object is the active thread managed by the body. There is an unique mapping between the active thread and the body responsible for it. From any method in the active object the current thread caller of the method is the active thread. When a reified method wants to get a reference to the Body associated to the active object, it can invoke this method. Assuming that the current thread is the active thread, the associated body is returned.

Returns:
the body associated to the active object whose active thread is calling this method.

getStubOnThis

public static StubObject getStubOnThis()
Returns a Stub-Proxy couple pointing to the local body associated to the active object whose active thread is calling this method.

Returns:
a Stub-Proxy couple pointing to the local body.
See Also:
getBodyOnThis()

migrateTo

public static void migrateTo(java.lang.Object activeObject)
                      throws MigrationException
Migrates the active object whose active thread is calling this method to the same location as the active object given in parameter. This method must be called from an active object using the active thread as the current thread will be used to find which active object is calling the method. The object given as destination must be an active object.

Parameters:
activeObject - the active object indicating the destination of the migration.
Throws:
MigrationException - if the migration fails
See Also:
getBodyOnThis()

migrateTo

public static void migrateTo(java.lang.String nodeURL)
                      throws MigrationException
Migrates the active object whose active thread is calling this method to the node caracterized by the given url. This method must be called from an active object using the active thread as the current thread will be used to find which active object is calling the method. The url must be the url of an existing node.

Parameters:
nodeURL - the url of an existing where to migrate to.
Throws:
MigrationException - if the migration fails
See Also:
getBodyOnThis()

migrateTo

public static void migrateTo(Node node)
                      throws MigrationException
Migrates the active object whose active thread is calling this method to the given node. This method must be called from an active object using the active thread as the current thread will be used to find which active object is calling the method.

Parameters:
node - an existing node where to migrate to.
Throws:
MigrationException - if the migration fails
See Also:
getBodyOnThis()

migrateTo

public static void migrateTo(Body bodyToMigrate,
                             java.lang.Object activeObject,
                             boolean priority)
                      throws MigrationException
Migrates the given body to the same location as the active object given in parameter. This method can be called from any object and does not perform the migration. Instead it generates a migration request that is sent to the targeted body. Two strategies are possible : - the request is high priority and is processed before all existing requests the body may have received (priority = true) - the request is normal priority and is processed after all existing requests the body may have received (priority = false) The object given as destination must be an active object.

Parameters:
bodyToMigrate - the body to migrate.
activeObject - the active object indicating the destination of the migration.
priority - a boolean indicating the priority of the migration request sent to the body.
Throws:
MigrationException - if the migration fails

migrateTo

public static void migrateTo(Body bodyToMigrate,
                             java.lang.String nodeURL,
                             boolean priority)
                      throws MigrationException
Migrates the given body to the node caracterized by the given url. This method can be called from any object and does not perform the migration. Instead it generates a migration request that is sent to the targeted body. Two strategies are possible : - the request is high priority and is processed before all existing requests the body may have received (priority = true) - the request is normal priority and is processed after all existing requests the body may have received (priority = false) The object given as destination must be an active object.

Parameters:
bodyToMigrate - the body to migrate.
nodeURL - the url of an existing where to migrate to.
priority - a boolean indicating the priority of the migration request sent to the body.
Throws:
MigrationException - if the migration fails

migrateTo

public static void migrateTo(Body bodyToMigrate,
                             Node node,
                             boolean priority)
                      throws MigrationException
Migrates the body bodyToMigrate to the given node. This method can be called from any object and does not perform the migration. Instead it generates a migration request that is sent to the targeted body. Two strategies are possible : - the request is high priority and is processed before all existing requests the body may have received (priority = true) - the request is normal priority and is processed after all existing requests the body may have received (priority = false) The object given as destination must be an active object.

Parameters:
bodyToMigrate - the body to migrate.
node - an existing node where to migrate to.
priority - a boolean indicating the priority of the migration request sent to the body.
Throws:
MigrationException - if the migration fails

waitForAny

public static int waitForAny(java.util.Vector futures)
Blocks the calling thread until one of the futures in the vector is available. THIS METHOD MUST BE CALLED FROM AN ACTIVE OBJECT.

Parameters:
futures - vector of futures
Returns:
index of the available future in the vector

waitForAll

public static void waitForAll(java.util.Vector futures)
Blocks the calling thread until all futures in the vector are available. THIS METHOD MUST BE CALLED FROM AN ACTIVE OBJECT.

Parameters:
futures - vector of futures

waitForTheNth

public static void waitForTheNth(java.util.Vector futures,
                                 int n)
Blocks the calling thread until the N-th of the futures in the vector is available. THIS METHOD MUST BE CALLED FROM AN ACTIVE OBJECT.

Parameters:
futures - vector of futures

isAwaited

public static boolean isAwaited(java.lang.Object future)
Return false if the object future is available. This method is recursive, i.e. if result of future is a future too, isAwaited is called again on this result, and so on.


getFutureValue

public static java.lang.Object getFutureValue(java.lang.Object future)
Return the object contains by the future (ie its target). If parameter is not a future, it is returned. A wait-by-necessity occurs if future is not available. This method is recursive, i.e. if result of future is a future too, getFutureValue is called again on this result, and so on.


enableAC

public static void enableAC(java.lang.Object obj)
                     throws java.io.IOException
Enable the automatic continuation mechanism for this active object.

java.io.IOException

disableAC

public static void disableAC(java.lang.Object obj)
                      throws java.io.IOException
Disable the automatic continuation mechanism for this active object.

java.io.IOException

setImmediateService

public static void setImmediateService(java.lang.Object obj,
                                       java.lang.String methodName)
                                throws java.io.IOException
Set an immmediate execution for the active object obj, ie request of name methodName will be executed by the calling thread, and not add in the request queue. BE CAREFULL : for the first release of this method, do not make use of getCurrentThreadBody nor getStubOnThis in the method defined by methodName !!

java.io.IOException

getJobId

public static java.lang.String getJobId()
Returns:
the jobId associated with the object calling this method

searchExceptionHandler

public static IHandler searchExceptionHandler(NonFunctionalException ex)
Search an appropriate handler for a given non functional exception. We first search in the highest level a handler for the real class of the exception. If the search fails, we try with mother classes. When no handler is available in this level, we go down into the hierarchy of levels.

Parameters:
ex - Exception for which we search a handler.
Returns:
A reliable handler or null if no handler is available

searchExceptionHandler

public static IHandler searchExceptionHandler(NonFunctionalException ex,
                                              java.util.HashMap level,
                                              int levelID)
Search an appropriate handler for a given non functional exception. We first search in the highest level a handler for the real class of the exception. If the search fails, we try with mother classes. When no handler is available in this level, we go down into the hierarchy of levels.

Parameters:
ex - Exception for which we search a handler.
level - The level where handlers are searched
Returns:
A reliable handler or null if no handler is available

setExceptionHandler

public static void setExceptionHandler(int ID_level,
                                       java.lang.Object obj,
                                       java.lang.Class hName,
                                       java.lang.Class exName)
Add a new handler to a specific level. Any existing handler is overwritten except at default level.

Parameters:
obj - The object containing a level. It is set to null if the ID_level represents default or VM level.
hName - The handler associated to a non functional exception.
exName - The class of the non functional exception which require a handler. It must be a subclass of NonFunctionalException.

unsetExceptionHandler

public static IHandler unsetExceptionHandler(int ID_level,
                                             java.lang.Object obj,
                                             java.lang.Class exName)
Remove the handler associated to a non functional exception.

Parameters:
obj - The object containing a level. It is set to null if the ID_level represents default or VM level.
exName - A non functional exception whoch does not require handler anymore at the given level.


Copyright © April 2004 INRIA All Rights Reserved.