|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--osl.manager.ActorImpl
|
+--osl.manager.basic.BasicActorImpl
This class defines the basic implementation of the ActorImpl class. The implementation provided here is very similar to the original ActorFoundry-0.2[alpha] implementation of the Actor class. Specifically, upon construction this implementation first discovers all of the available public methods (minus constructors) of the actor it encapsulates. Each such public method is a valid target for an external message.
After initializing itself, the implementation calls the encapsulated actor's constructor, after which messages are processed as usual. Any synchronous exceptions (that is, those that result directly from calls by the encapsulated actor) are immediately returned to the actor. Asynchronous exceptions are not yet passed back to the encapsulated actor.
BasicActorManager,
BasicActorName,
MethodStructure,
MethodStructureVector, Serialized Form| Field Summary | |
protected java.lang.Object[] |
conArgs
The array of arguments to pass to the constructor of the encapsulated actor when it is instantiated. |
protected ActorCreateRequest |
createReq
A reference to the create request which was used to create this actor. |
protected WaitQueue |
mailQueue
The mail queue for this actor. |
ActorManagerName |
managerName
The ActorManagerName of our actor manager. |
protected ActorManagerName |
migrateTo
If this field is non-null, then the actor wishes to be migrated after the current method has finished. |
protected Actor |
ourActor
The actor instance that we manage. |
protected ActorManager |
ourManager
The ActorManager which manages this actor. |
protected java.util.Hashtable |
ourMethods
This hashtable hashes the names of our public methods to an array of MethodStructure instances for quick lookup during method invocation. |
protected osl.manager.basic.BasicActorImpl.WaitRPCReply |
scanQueue
This field holds a class instance which is used to search mail queues for RPC reply messages. |
| Fields inherited from class osl.manager.ActorImpl |
actorClass,
classRef,
context,
extensionMethods,
nextID,
self |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY |
| Constructor Summary | |
BasicActorImpl()
|
|
| Method Summary | |
protected void |
actorDeliver(ActorMsgRequest msg)
This method is called by a manager to deliver a new message to the local actor. |
protected void |
actorInitialize(ActorManager ourMgr,
ActorName you,
ActorCreateRequest req)
This method is called to initialize the actor implementation after it is instantiated. |
protected void |
actorPostMigrateRebuild(ActorManager ourMgr)
This method is called by the new manager of an actor implementation just after migration has occurred. |
protected java.lang.reflect.Constructor |
findConstructor(java.lang.Class classType,
java.lang.Object[] args)
This function returns the appropriate constructor for building an actor class based on its type and the signatures of the arguments supplied. |
protected ActorName |
implCreate(ActorCreateRequest req)
Request a new actor to be created. |
protected void |
implDestroy(java.lang.String reason)
Request to remove this actor from the system. |
protected java.lang.Object |
implInvokeService(ServiceName name,
java.lang.String meth,
java.lang.Object[] args)
Request a service invocation on the named node service. |
protected void |
implMigrate(ActorManagerName loc)
Request that this actor wishes to be migrated to a new location. |
protected java.lang.Object |
implSend(ActorMsgRequest msg)
Request a message to be sent. |
protected void |
initializeActor()
This method initializes the standard streams for this implementation and attempts to create the Actor requested in the create message. |
protected java.lang.Object |
invokeMethod(java.lang.String nextMethod,
java.lang.Object[] methodArgs)
This method is called from run to invoke a method on this actor. |
protected void |
processMessage(ActorMsgRequest nextMsg)
This method handles the processing of the next message on the actor's mail queue. |
void |
run()
The run method for the basic actor implementation. |
| Methods inherited from class osl.manager.ActorImpl |
buildAsynchException,
finalize,
formatAsynchException,
implExtension,
mgrActorCreate,
mgrActorFatalError,
mgrActorInvokeService,
mgrActorMigrate,
mgrActorSend,
registerExtension,
removeExtension,
setCreatingThread,
stampRequest |
| Methods inherited from class java.lang.Thread |
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getContextClassLoader,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
setContextClassLoader,
setDaemon,
setName,
setPriority,
sleep,
sleep,
start,
stop,
stop,
suspend,
toString,
yield |
| Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected Actor ourActor
protected transient java.lang.Object[] conArgs
protected WaitQueue mailQueue
protected transient ActorManager ourManager
public transient ActorManagerName managerName
protected transient java.util.Hashtable ourMethods
protected osl.manager.basic.BasicActorImpl.WaitRPCReply scanQueue
protected transient ActorManagerName migrateTo
protected ActorCreateRequest createReq
| Constructor Detail |
public BasicActorImpl()
| Method Detail |
protected java.lang.Object invokeMethod(java.lang.String nextMethod,
java.lang.Object[] methodArgs)
throws java.lang.NoSuchMethodException,
java.lang.reflect.InvocationTargetException,
java.lang.IllegalAccessException
nextMethod - The String naming the next
method to invoke on the encapsulated actor.methodArgs - An array of Objects to pass to
the target method.
protected void processMessage(ActorMsgRequest nextMsg)
throws java.lang.Exception
nextMsg - The ActorMsgRequest to process.
protected void initializeActor()
throws java.lang.Exception
public void run()
protected java.lang.reflect.Constructor findConstructor(java.lang.Class classType,
java.lang.Object[] args)
throws java.lang.NoSuchMethodException
classType - A Class describing the complete
class type of the actor.args - The set of arguments to be supplied to the
constructor. If the default constructor is to be invoked, then
this must be a 0 length array NOT null.
protected void actorInitialize(ActorManager ourMgr,
ActorName you,
ActorCreateRequest req)
throws java.lang.Exception
The semantics of ActorImpl require that any exceptions which result from the creation of the actor should be thrown from this method. Therefore, the new user actor is created within this method and its constructor is called. If the user actor attempts to make a "call" to the creating actor, then a run-time exception is returned and the actor is never created. This is done because any such call never has a hope of completing as the creator is blocked waiting for the address of the new actor (and therefore can't respond to the call).
ourMgr - The ActorManager which should be
used by this actor implementation to invoke actor services.you - The ActorName that should be used as
the name of the new actor.req - The ActorCreateReq that requested this
new actor to be created. Error messages during the creation
should be sent to the "requester" stored in this request.protected void actorPostMigrateRebuild(ActorManager ourMgr)
ourMgr - A reference to the new manager of the
implementation after migration has occurred.protected void actorDeliver(ActorMsgRequest msg)
msg - The ActorMsgRequest structure to be
delivered. This structure must be maintained by the actor as it
is required if an exception is returned to the manager.
protected java.lang.Object implSend(ActorMsgRequest msg)
throws RemoteCodeException
msg - The ActorMsgRequest describing the
message to send.
protected ActorName implCreate(ActorCreateRequest req)
throws java.lang.SecurityException,
RemoteCodeException
req - The ActorCreateRequest describing the
new actor to create.protected void implMigrate(ActorManagerName loc)
loc - The ActorManagerName of the node to
migrate to. Passing a value of null cancels any
previous migration request.
protected java.lang.Object implInvokeService(ServiceName name,
java.lang.String meth,
java.lang.Object[] args)
throws ServiceNotFoundException,
ServiceException
name - The ServiceName describing the
service to invoke.args - The Object argument to pass to the
service invocation function.protected void implDestroy(java.lang.String reason)
reason - A String giving a "reason" for the
removal. This string should normally be appended to the log for
the actor before removing it from the system.Actor.destroy(java.lang.String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||