|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.caucho.amp.actor.AmpActorContext
com.caucho.amp.actor.ActorContextImpl
public final class ActorContextImpl
Handles the context for an actor, primarily including its query map.
Constructor Summary | |
---|---|
ActorContextImpl(java.lang.String address,
AmpActor actorStream,
AmpMailboxFactory mailboxFactory)
|
Method Summary | |
---|---|
void |
close()
Registers a callback future. |
void |
error(AmpActorRef to,
AmpActorRef from,
AmpEncoder encoder,
AmpError error)
Sends a message error to an ActorHolder ,
addressed by the Actor's address. |
AmpActorRef |
getActorRef()
|
java.lang.String |
getAddress()
|
AmpMailbox |
getMailbox()
|
AmpMethodRef |
getMethod(java.lang.String methodName,
AmpEncoder encoder)
|
long |
getQueryTimeout()
|
AmpStream |
getStream()
|
void |
handleAlarm(Alarm alarm)
Handles a callback from an alarm. |
void |
query(AmpMethodRef methodRef,
java.lang.Object[] args,
AmpQueryCallback cb,
long timeout)
|
void |
query(long id,
AmpActorRef to,
AmpActorRef from,
AmpEncoder encoder,
java.lang.String methodName,
java.lang.Object... args)
Sends a query/RPCinformation call The receiver of a query acts as a service and the
caller acts as a client. |
void |
queryError(long id,
AmpActorRef to,
AmpActorRef from,
AmpEncoder encoder,
AmpError error)
Sends a query error from a failed query. |
void |
queryResult(long id,
AmpActorRef to,
AmpActorRef from,
AmpEncoder encoder,
java.lang.Object result)
Sends a query response for a query |
void |
send(AmpActorRef to,
AmpActorRef from,
AmpEncoder encoder,
java.lang.String methodName,
java.lang.Object... args)
Sends a unidirectional message to an ActorHolder ,
addressed by the Actor's address. |
void |
setQueryTimeout(long timeout)
|
java.lang.String |
toString()
|
Methods inherited from class com.caucho.amp.actor.AmpActorContext |
---|
beginCurrentActor, endCurrentActor, getCurrent, getCurrent, send |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ActorContextImpl(java.lang.String address, AmpActor actorStream, AmpMailboxFactory mailboxFactory)
Method Detail |
---|
public java.lang.String getAddress()
getAddress
in class AmpActorContext
public AmpMailbox getMailbox()
getMailbox
in class AmpActorContext
public AmpActorRef getActorRef()
getActorRef
in class AmpActorContext
public AmpStream getStream()
getStream
in class AmpActorContext
public AmpMethodRef getMethod(java.lang.String methodName, AmpEncoder encoder)
getMethod
in interface AmpActor
getMethod
in class AmpActorContext
public long getQueryTimeout()
public void setQueryTimeout(long timeout)
public final void send(AmpActorRef to, AmpActorRef from, AmpEncoder encoder, java.lang.String methodName, java.lang.Object... args)
AmpStream
ActorHolder
,
addressed by the Actor's address.
send
in interface AmpStream
to
- the target actor's addressfrom
- the source actor's addresspublic void error(AmpActorRef to, AmpActorRef from, AmpEncoder encoder, AmpError error)
AmpStream
ActorHolder
,
addressed by the Actor's address. Actor protocols may choose to send
error messages if a message fails for some reason.
In general, Actors should not rely on the delivery of error messages.
If an error return is required, use an RPC query instead.
error
in interface AmpStream
to
- the target actor's addressfrom
- the source actor's addresserror
- the message errorpublic void query(long id, AmpActorRef to, AmpActorRef from, AmpEncoder encoder, java.lang.String methodName, java.lang.Object... args)
AmpStream
query
acts as a service and the
caller acts as a client. Because BAM Actors are symmetrical, all
Actors can act as services and clients for different RPC calls.
The stream MUST send a queryResult
or
queryError
to the client using the same id
,
because RPC clients rely on a response.
query
in interface AmpStream
id
- the query identifier used to match requests with responsesto
- the service actor's addressfrom
- the client actor's addresspublic void queryResult(long id, AmpActorRef to, AmpActorRef from, AmpEncoder encoder, java.lang.Object result)
AmpStream
queryResult
in interface AmpStream
id
- the query identifier used to match requests with responsesto
- the client actor's addressfrom
- the service actor's addresspublic void queryError(long id, AmpActorRef to, AmpActorRef from, AmpEncoder encoder, AmpError error)
AmpStream
queryError
in interface AmpStream
id
- the query identifier used to match requests with responsesto
- the client actor's addressfrom
- the service actor's addresserror
- additional error informationpublic void query(AmpMethodRef methodRef, java.lang.Object[] args, AmpQueryCallback cb, long timeout)
query
in class AmpActorContext
public void close()
public java.lang.String toString()
toString
in class java.lang.Object
public void handleAlarm(Alarm alarm)
AlarmListener
handleAlarm
in interface AlarmListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |