|
|||||||||
| 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.StreamOutputActorImpl
This class defines the implementation of an actor used to control an output stream on behalf of external actors. We require an implementation (rather than an Actor) because if a security manager is running (i.e. startfoundry was specified with the -secure option), then user-written actors will not have direct access to several standard streams (e.g. System.out). Since instances of ActorImpl are privileged they may control such streams and provide their services to specific actors. The methods exported to external actors is defined by the StreamOutputActor interface. In the current implementation, the first argument passed in the creation request for this actor is used to determine which output stream to manage. If the argument is "out", then System.out is managed. If the argument is "err", then System.err is managed. Otherwise, an error is returned by actorInitialize.
osl.manager.basic.StreamOutputActor, Serialized Form| Field Summary | |
protected WaitQueue |
mailQueue
The queue which holds incoming requests. |
protected ActorManager |
ourManager
The manager which manages this implementation. |
| 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 | |
StreamOutputActorImpl()
|
|
| 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 by a manager to initialize an 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. |
void |
close()
Close the internal output stream. |
void |
flush()
Flush the internal output stream. |
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. |
void |
print(java.lang.Object s)
Print an object representation to the output stream. |
void |
print(java.lang.String s)
Print a string to the output stream. |
void |
println(java.lang.Object s)
Print an object representation followed by a newline character. |
void |
println(java.lang.String s)
Print a string followed by a newline character. |
void |
run()
The main run loop for this implementation. |
void |
write(java.lang.Byte[] b)
Write the contents of a byte array to the internal output stream. |
void |
write(java.lang.Byte[] b,
java.lang.Integer off,
java.lang.Integer len)
Write a subsequence of a byte array to the output stream. |
void |
write(java.lang.Integer b)
Writes a byte to the internal output stream. |
| 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 ActorManager ourManager
protected WaitQueue mailQueue
| Constructor Detail |
public StreamOutputActorImpl()
| Method Detail |
protected void actorInitialize(ActorManager ourMgr,
ActorName you,
ActorCreateRequest req)
For this implementation, the manager reference and actor name are saved. The first constructor argument in the creation request is expected to be either the strint "out" or "err", indicating which System stream should be managed. An error is returned if no string is present.
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.rtClass - The run-time Class of the
user-written actor that should be instantiated by this
implementation. This class will always be an extension of the
Actor class.initArgs - The array of arguments to pass to the
constructor of the user-defined actor when it is instantiated.ActorManager.implInitialize(osl.manager.ActorImpl, osl.manager.ActorName, osl.manager.ActorCreateRequest)protected void actorDeliver(ActorMsgRequest msg)
For this implementation, we deposit the new message in our mail queue so that it can be processed in the main run loop.
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 void actorPostMigrateRebuild(ActorManager ourMgr)
This method should never be called for this implementation as StreamOutputActorImpls will never migrate. If this method IS called for some reason then a runtime exception is thrown.
ourMgr - A reference to the new manager of the
implementation after migration has occurred.
protected java.lang.Object implSend(ActorMsgRequest msg)
throws RemoteCodeException
This method should never be called in this implementation since no internal actor is ever created.
msg - The ActorMsgRequest describing the
message to send.Actor.send(ActorName, String),
Actor.call(ActorName, String)
protected ActorName implCreate(ActorCreateRequest req)
throws java.lang.SecurityException,
RemoteCodeException
This method should never be called in this implementation since no internal actor is ever created.
req - The ActorCreateRequest describing the
new actor to create.Actor.create(String),
Actor.create(Class),
Actor.create(ActorManagerName, String),
Actor.create(ActorManagerName, Class)protected void implMigrate(ActorManagerName loc)
This method should never be called in this implementation since no internal actor is ever created.
loc - The ActorManagerName of the node to
migrate to.Actor.migrate(osl.manager.ActorManagerName),
Actor.cancelMigrate()
protected java.lang.Object implInvokeService(ServiceName name,
java.lang.String meth,
java.lang.Object[] args)
throws ServiceNotFoundException,
ServiceException
This method should never be called in this implementation since no internal actor is ever created.
name - The ServiceName describing the
service to invoke.args - The Object argument to pass to the
service invocation function.Actor.invokeService(osl.service.ServiceName, java.lang.String)protected void implDestroy(java.lang.String reason)
This method should never be called in this implementation since no internal actor is ever created.
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)
public void write(java.lang.Integer b)
throws java.io.IOException
b - An Integer giving the byte to write.
public void write(java.lang.Byte[] b)
throws java.io.IOException
b - A Byte array of data to write to the
output stream.
public void write(java.lang.Byte[] b,
java.lang.Integer off,
java.lang.Integer len)
throws java.io.IOException
b - A Byte array of data from which a
subsequence will be written to the output stream.off - An Integer giving the index in the
data to start the write from.len - An Integer giving the total number of
bytes to write.
public void print(java.lang.String s)
throws java.io.IOException
s - The String to display.
public void println(java.lang.String s)
throws java.io.IOException
s - The String to display.
public void print(java.lang.Object s)
throws java.io.IOException
s - The String to display.
public void println(java.lang.Object s)
throws java.io.IOException
s - The String to display.
public void flush()
throws java.io.IOException
public void close()
throws java.io.IOException
public void run()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||