|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--osl.manager.ActorManager
|
+--osl.manager.basic.BasicActorManager
This class defines the basic implementation of the ActorManager class. The purpose of this class is to serve as a reference implementation for operating the foundry. This class was designed with modularity in mind so that new implementations could be created simply by extending this class.
BasicActorImpl,
ActorManager,
ActorImpl| Inner Class Summary | |
protected class |
BasicActorManager.ActorEntry
This class encapsulates an entry in the local managed_actors table. |
protected class |
BasicActorManager.ServiceThread
This class defines a "service" thread, which is used to handle asynchronous tasks for the BasicActorManager. |
| Field Summary | |
protected Scheduler |
actorScheduler
The scheduler for this actor manager. |
java.lang.String |
AM_VERSION
Version information for this actor manager implementation. |
protected ActorName |
defaultActorName
The default actor name which is reserved for special use by this manager. |
protected java.util.Hashtable |
localServices
This hashtable maintains the current set of registered services available to local actors. |
protected java.util.Hashtable |
managed_actors
This field hashes ActorNames to the ActorImpl instances they are associated with. |
protected ActorManagerName |
managerName
The name of this actor manager. |
static int |
numServiceThreads
The initial number of "service" threads to create in the manager. |
protected RequestHandler |
ourHandler
The request handler implementation to use for creating request sessions for this manager. |
protected java.util.Hashtable |
remoteCreates
This hashtable temporarily holds messages for actors which are being created remotely (that is, it hashes ActorNames to Vectors). |
protected java.util.Hashtable |
requestMap
This table hashes RequestID's to the requests associated with the ID. |
static long |
SERVICE_TIMEOUT
The length of time that a service thread should wait before killing itself off (currently 5 minutes). |
protected Queue |
serviceQueue
The queue of waiting "service" threads. |
protected RequestSession |
session
The session used by this actor manager to interact with remote managers. |
| Constructor Summary | |
BasicActorManager()
The default constructor. |
|
| Method Summary | |
protected ActorName |
actorCreate(ActorImpl caller,
ActorCreateRequest request)
This method is called by a local actor to request the creation of a new actor. |
ActorName |
actorCreateAlias(ActorImpl caller)
Create an alias for an actor. |
protected void |
actorFatalError(ActorImpl caller,
java.lang.Exception e)
This method is called by an actor implementation to report that it has encountered a fatal error. |
java.lang.Object |
actorInvokeService(ActorImpl caller,
ServiceName serviceName,
java.lang.String meth,
java.lang.Object[] serviceArgs)
This method is called by a local actor in order to access a locally provided node service. |
void |
actorMigrate(ActorImpl caller,
ActorManagerName where)
This method is called by a local actor that wishes to be migrated to another manager. |
protected void |
actorSend(ActorImpl caller,
ActorMsgRequest message)
This method is called by a local actor to send a message to another actor. |
void |
handlerException(RequestSession session,
java.lang.Exception except,
RequestID id)
Called when an exception has been received for an asynchronous request sent on a particular session. |
protected void |
implDeliver(ActorImpl actor,
ActorMsgRequest msg)
This method simply calls ActorManager.implDeliver. |
ActorName |
managerCreate(ActorCreateRequest request,
ActorName reqName)
This method is called to request that a new local actor be created and managed by the target actor. |
void |
managerDeliver(ActorMsgRequest del)
This method is called to indicate that a new message should be delivered to a local actor. |
ActorManagerName |
managerGetName()
Returns the name of this actor manager. |
void |
managerInitialize(Scheduler S,
RequestHandler R)
Initialize a new actor manager. |
java.lang.Object |
managerInvokeService(ServiceName serviceName,
java.lang.String meth,
java.lang.Object[] serviceArgs)
Called by other foundry modules (or remote managers) to invoke a local service. |
void |
managerMigrate(ActorMigrationStructure mig)
This method is called to pass an actor migration request. |
void |
managerRegisterService(ServiceName sName,
Service S)
Called externally to register a new node service. |
void |
managerRemoveService(ServiceName sName)
Called externally to remove a node service. |
| Methods inherited from class osl.manager.ActorManager |
implGetName,
implInitialize,
implPostMigrateRebuild,
implStamp |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public java.lang.String AM_VERSION
public static final int numServiceThreads
public static final long SERVICE_TIMEOUT
protected Scheduler actorScheduler
protected RequestHandler ourHandler
protected RequestSession session
protected ActorName defaultActorName
protected java.util.Hashtable managed_actors
protected java.util.Hashtable remoteCreates
protected java.util.Hashtable localServices
protected ActorManagerName managerName
protected java.util.Hashtable requestMap
protected Queue serviceQueue
| Constructor Detail |
public BasicActorManager()
| Method Detail |
protected void implDeliver(ActorImpl actor,
ActorMsgRequest msg)
actor - The ActorImpl to deliver the message
to.msg - The ActorMsgRequest to deliver.
public void managerInitialize(Scheduler S,
RequestHandler R)
throws RequestException
S - The Scheduler instance which should be
used to schedule all threads required by the manager. Most of
these threads will correspond to actors. Thus, it is
advantageous to use a scheduler customized to efficiently handle
actors.R - The RequestHandler instance which should
be used for interactions between this manager and other managers
in the system.
protected ActorName actorCreate(ActorImpl caller,
ActorCreateRequest request)
throws java.lang.SecurityException,
RemoteCodeException
If an exception is thrown by this method (asynchronously or otherwise) then the returned actor name is no longer valid and any messages sent to it will be discarded. The following asynchronous exceptions may be thrown:
request - The ActorCreateRequest structure
which describes the new actor to be created.
protected void actorSend(ActorImpl caller,
ActorMsgRequest message)
throws RemoteCodeException
If an exception is returned by this method then the message structure is never sent. For asynchronous exceptions, only the RemoteCodeException corresponds to a message structure which should be viewed as "delivered". All other asynchronous exceptions should be interpreted as indicating that the original message structure was never sent. The following asynchronous exceptions may be thrown:
message - The ActorMsg structure which
indicates the sender and receiver of the message, the method to
invoke on the receiver, and any arguments to pass to the target
method.
protected void actorFatalError(ActorImpl caller,
java.lang.Exception e)
thrower - The ActorImpl signalling the fatal
error. Usually, this actor will be removed from the system.e - The Exception which describes the fatal
error encountered in the actor.
public void actorMigrate(ActorImpl caller,
ActorManagerName where)
throws IllegalNodeException,
RemoteRequestRefusedException,
RemoteCodeException
thrower - A reference to the ActorImpl which
wishes to be migrated.where - The ActorManagerName of the manager
where this actor should be moved.
public java.lang.Object actorInvokeService(ActorImpl caller,
ServiceName serviceName,
java.lang.String meth,
java.lang.Object[] serviceArgs)
throws ServiceNotFoundException,
ServiceException
serviceName - The ServiceName of the service
to invoke.serviceArgs - An Object which represents the
sole argument to pass to the invocation function of the service.
public ActorName managerCreate(ActorCreateRequest request,
ActorName reqName)
throws RemoteRequestRefusedException,
RemoteCodeException,
IllegalTargetException,
java.lang.IllegalAccessException
request - An ActorCreateRequest structure
describing the new actor to be created. The ID and site fields
are ignored and the new actor is always created locally.newName - An optional argument indicating the desired
ActorName of the new actor. If null then a new actor
name is generated, otherwise an attempt is made to use the
provided name.
public void managerDeliver(ActorMsgRequest del)
throws IllegalTargetException,
RemoteRequestRefusedException,
RemoteCodeException
del - The ActorMsg structure to deliver to a
local actor.
public void managerMigrate(ActorMigrationStructure mig)
throws RemoteRequestRefusedException,
RemoteCodeException
mig - The ActorMigrationStructure giving the
properties of the actor to migrate.
public void managerRegisterService(ServiceName sName,
Service S)
sName - The ServiceName of the new service.S - A reference to the new Service.
public void managerRemoveService(ServiceName sName)
throws ServiceNotFoundException
sName - The name of the service to remove.
public java.lang.Object managerInvokeService(ServiceName serviceName,
java.lang.String meth,
java.lang.Object[] serviceArgs)
throws ServiceNotFoundException,
ServiceException
serviceName - The ServiceName of the service
to invoke.serviceArgs - An Object which represents the
sole argument to pass to the invocation function of the service.public ActorManagerName managerGetName()
public void handlerException(RequestSession session,
java.lang.Exception except,
RequestID id)
session - The RequestSession that the
original asynchronous call originated from. This field is
provided so that clients with multiple handler sessions may
disambiguate the origin of exceptions.except - The Exception which was returned
from the remote handler. This will either be a
NoSuchMethodException which indicates that no matching
method could be found on the target (and thus the method was
never invoked); or a RemoteException which encapsulates
an exception thrown by the remote method itself (however, the
remote method WAS invoked).id - The RequestID of the original request
which caused the exception. This information is used to
disambiguate multiple asynchronous exceptions.public ActorName actorCreateAlias(ActorImpl caller)
N.B.: This will only work for non-migrating actors. That's not to say that an aliased actor can't be migrated, but strange things will happen if that DOES occur. Have to formalize this at some later date!!!!
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||