java.lang.isolate
Class IsolateEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--java.lang.isolate.IsolateEvent
All Implemented Interfaces:
Serializable

public class IsolateEvent
extends EventObject

Isolate events represent state changes in an isolate lifecycle. Isolate events are issued when the isolate changes its execution state (to STARTING, STOPPING, and finally TERMINATED). Isolate events are initially delivered on a Link associated with the source isolate and obtained via newEventLink() but may be forwarded over other links subsequently.

All events have a "type" (see getType()) and provide a handle to the isolate associated with the event (see getIsolate()). The TERMINATED events have an integer exit status (available via getExitStatus()) associated with them and exit "reason codes" (available via getExitReason()). The other event types have no additional information available.

The source of the EventObject view of an IsolateEvent is the Isolate object associated with the event.

See Also:
Isolate.newEventLink(java.lang.isolate.Isolate), Serialized Form

Nested Class Summary
 class IsolateEvent.ExitReason
          Provides information about how an isolate became terminated.
 
Field Summary
static int STARTING
          The starting state.
static int STOPPING
          The stopping state.
static int TERMINATED
          The terminated state.
 
Constructor Summary
IsolateEvent(java.lang.isolate.Isolate isolate, int type, int status)
          Constructs an IsolateEvent with the given type and exit status.
 
Method Summary
 IsolateEvent.ExitReason getExitReason()
          Gets information about how an isolate died.
 int getExitStatus()
          Gets the exit status of an Isolate.
 java.lang.isolate.Isolate getIsolate()
          Gets the Isolate instance associated with this IsolateEvent.
 int getType()
          Gets the type of this event.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STARTING

public static final int STARTING
The starting state. A STARTING event results from an isolate's start method being invoked and indicates execution of user code is able to commence. At most one STARTING event will be delivered on behalf of an isolate and no isolate event will be delivered before a STARTING event.

See Also:
Constant Field Values

STOPPING

public static final int STOPPING
The stopping state. A STOPPING event results from any one of a number of actions that may initiate shutdown of an isolate:

At most, one STOPPING event will be delivered on behalf of an isolate, even if any of the above occur more than once for that isolate. A STOPPING event will always be preceded by a STARTING event. Additional code such as shutdown hooks or finalizers may be executed by an isolate after a STOPPING event is issued.

See Also:
System.exit(int), Runtime.exit(int), Runtime.halt(int), Isolate.exit(int), Isolate.halt(int), Constant Field Values

TERMINATED

public static final int TERMINATED
The terminated state. A TERMINATED event is supplied when an isolate has terminated. This event is issued at the point when no additional user code will execute in the associated isolate.

The exit code of the associated isolate is available via the getExitStatus() method. The exit status of an isolate defaults to 0 but will be set to the parameter passed to the exit or halt method that terminated the isolate. If such exit methods are invoked multiple times, the exit status may be any one of the provided values, with the restriction that all TERMINATED events report the same value for the associated isolate.

At most one TERMINATED event will be delivered on behalf of an isolate to a particular event link. A TERMINATED event will always be preceded by a STOPPING event. Additionally, no more events will be delivered following a TERMINATED event.

See Also:
Isolate.isTerminated(), System.exit(int), Runtime.exit(int), Runtime.halt(int), Isolate.exit(int), Isolate.halt(int), Constant Field Values
Constructor Detail

IsolateEvent

public IsolateEvent(java.lang.isolate.Isolate isolate,
                    int type,
                    int status)
Constructs an IsolateEvent with the given type and exit status. The isolate must not be null and the type, and status parameters must be valid and consistent.

Method Detail

getIsolate

public java.lang.isolate.Isolate getIsolate()
Gets the Isolate instance associated with this IsolateEvent. Equivalent to:
   (Isolate)(isoEvent.getSource())
 

Returns:
Isolate associated with this event.

getType

public int getType()
Gets the type of this event. Type values are STARTING, STOPPING, or TERMINATED.

Returns:
the type of this event.

getExitStatus

public int getExitStatus()
Gets the exit status of an Isolate. Only applicable for a TERMINATED event.

Returns:
the exit status of the associated isolate.
Throws:
IllegalStateException - if not a TERMINATED event

getExitReason

public IsolateEvent.ExitReason getExitReason()
Gets information about how an isolate died. Only applicable for a TERMINATED event.

Returns:
the exit status of the associated isolate.
Throws:
IllegalStateException - if not a TERMINATED event