|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<CallCompletion>
org.curjent.agent.CallCompletion
public enum CallCompletion
Reason codes for why a call finished.
Enum Constant Summary | |
---|---|
CALL_EXPIRED
Call waited too long to begin executing. |
|
CALL_FAILED
The caller failed with an unexpected exception. |
|
CALLER_DEADLOCKED
The caller deadlocked with other callers while waiting on the call, and the call was terminated because of the deadlock. |
|
CALLER_INTERRUPTED
The caller was interrupted while waiting on the call, and the call was terminated because of the interrupt. |
|
CAPACITY_EXCEEDED
The agent's queue capacity was exceeded. |
|
FUTURE_CANCELLED
Call was forcibly canceled with Future.cancel(boolean) . |
|
LISTENER_FINISHED
Call was forcibly finished with either AgentCall.finish() or
AgentCall.finish(boolean, boolean, Object, Throwable) . |
|
NOT_FINISHED
Call is still queued or executing. |
|
TASK_FINISHED
Call completed normally. |
Method Summary | |
---|---|
static CallCompletion |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static CallCompletion[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final CallCompletion NOT_FINISHED
public static final CallCompletion TASK_FINISHED
public static final CallCompletion LISTENER_FINISHED
AgentCall.finish()
or
AgentCall.finish(boolean, boolean, Object, Throwable)
. The
executing task was potentially abandoned.
public static final CallCompletion FUTURE_CANCELLED
Future.cancel(boolean)
. The
executing task was potentially abandoned.
public static final CallCompletion CAPACITY_EXCEEDED
CapacityExceededException
.
Capacity
public static final CallCompletion CALL_EXPIRED
ExpiredException
.
Expiration
public static final CallCompletion CALLER_INTERRUPTED
For example, an agent of a caller interrrupted while awaiting a
pending call will terminate the call with an
InterruptedException
and a call completion value of
CALLER_INTERRUPTED
. (See Capacity
for details on
pending calls.)
This applies only to the caller's thread, not to the task's
thread. If the task's thread is interrupted, and the task's method throws
the InterruptedException
, the call's completion value is
TASK_FINISHED
.
Not all caller thread interrupts terminate the call. Callers interrupted
while waiting on Future.get()
or
Future.get(long, TimeUnit)
are thrown an
InterruptedException
, but the state of the call does not
change.
Synchronous calls are another specical case. Synchronous calls simulate
direct method calls. Upon receiving the interrupt from the waiting
client's thread, the agent propagates the interrupt to the task's thread
by clearing the client thread's interrupt and setting the task thread's
interrupt. If the task's method throws an
InterruptedException
, the call's completion value is set to
TASK_FINISHED
, and the agent throws an exception to the
caller (either the InterruptedException
if the agent's
interface method explicitly declares that it can throw an
InterruptedException
, or a new AgentException
with the InterruptedException
as the cause). (See
Synchronous
for details on synchronous calls.)
public static final CallCompletion CALLER_DEADLOCKED
For example, an agent of two or more callers deadlocked while awaiting a
pending call will terminate one of the calls with an
DeadlockException
and a call completion value of
CALLER_DEADLOCKED
. (See Capacity
for details on
pending calls.)
Similarly, a caller waiting on a synchronous call may receive a
DeadlockException
. The call is terminated in this case, and
the call completion value is set to CALLER_DEADLOCKED
. (Once
a synchronous call starts executing, though, it is no longer considered
for deadlock. See Synchronous
for details on synchronous calls.)
Not all caller deadlocks terminate the call. One caller deadlocked while
waiting on Future.get()
or Future.get(long, TimeUnit)
is
thrown a DeadlockException
, but the state of the call does
not change.
public static final CallCompletion CALL_FAILED
For example, a custom implementation of AgentTasks
may throw an
unknown type of exception when a call is initially sent to an agent. The
call is terminated with a CALL_FAILED
completion value in
this case, and the exception is thrown to the caller, wrapped in an
unchecked AgentException
as appropriate.
This applies only to the caller's thread of execution, not to the
task's thread of execution. If the task's method throws an
exception, the call's completion value is TASK_FINISHED
.
Method Detail |
---|
public static CallCompletion[] values()
for (CallCompletion c : CallCompletion.values()) System.out.println(c);
public static CallCompletion valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |