Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
 

com.newstep.solid.management.runtime
Class ExecStateFuture
All Implemented Interfaces:
       Future, ManagedExecutableListener

public class ExecStateFuture      
Provides a mechanism for synchronously waiting for an ManagedExecutable
to reach a stable state. The ExecStateFuture is provided by the
AsyncExecHelper to allow clients to block waiting for the specified state to
be transitioned. The ExecStateFuture acts as a ManagedExecutableListener to
the ManagedExecutable such that it is aware of all the execution state
transitions on the executable. When the future is initialized, the pending state is
specified such that the future knows what state it is waiting for. In the
case of invalid state transitions the existing future will be maintained and
the returned future will be cancelled. In the case of exceptions the future
will redeem as ERROR. In the case of a pre-emptive stop during a shutdown,
both futures will redeem when the executable transitions to DONE.
Implements:
Future
ManagedExecutableListener
 
Links:
Kernel Association Association Link
to Enumeration ExecState
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
package
 
Kernel Association Association Link
to Enumeration ExecState
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
package
 
Kernel Association Association Link
to Interface ManagedExecutable
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
package
 
Implementation Implementation Link
to Interface ManagedExecutableListener
Provides a mechanism for synchronously waiting for an ManagedExecutable
to reach a stable state. The ExecStateFuture is provided by the
AsyncExecHelper to allow clients to block waiting for the specified state to
be transitioned. The ExecStateFuture acts as a ManagedExecutableListener to
the ManagedExecutable such that it is aware of all the execution state
transitions on the executable. When the future is initialized, the pending state is
specified such that the future knows what state it is waiting for. In the
case of invalid state transitions the existing future will be maintained and
the returned future will be cancelled. In the case of exceptions the future
will redeem as ERROR. In the case of a pre-emptive stop during a shutdown,
both futures will redeem when the executable transitions to DONE.
 
 

Field Summary
boolean
boolean
CountDownLatch
Constructor Summary
protected void
Method Summary
public boolean
cancel(Boolean mayInterruptIfRunning)
public void
public void
public ExecState
get(Long timeout, TimeUnit unit)
public ExecState
get()
public void
public boolean
public boolean
public void
public void
public void
public void
public void
public void
public void
Field Detail
isCancelled
boolean isCancelled
Multiplicity:
1
 

isDone
boolean isDone
Multiplicity:
1
 

latch
CountDownLatch latch
Multiplicity:
1
 

mgdExec
ManagedExecutable mgdExec
Multiplicity:
1
 

pendingState
ExecState pendingState
Multiplicity:
1
 

resultState
ExecState resultState
Multiplicity:
1
 
Constructor Detail
ExecStateFuture
protected void ExecStateFuture (ExecState pendingState, ManagedExecutable mgdExec)
 
constructor initializes the future with its pending state
Parameters:
pendingState the state on which the future is redeemable
mgdExec the ManagedExecutable to track
Stereotype:
create
 
Method Detail
cancel
public boolean cancel (Boolean mayInterruptIfRunning)
 
cancel the pending future


NOTE:cancelling the future does not cancel the requested transition
it simply cancels the future and its ability to wait and notify for the
transition

Parameters:
mayInterruptIfRunning indicates if the future may be cancelled if
it is running
Return:
FALSE if the task could not be cancelled, typically because it
has already completed normally, TRUE if the task was cancelled.
 

done
public void done (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the DONE state
Parameters:
executable the ManagedExecutable whose state has changed
 

error
public void error (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the ERROR state
Parameters:
executable the ManagedExecutable whose state has changed
 

get
public ExecState get (Long timeout, TimeUnit unit)
 
redeems the executable state indicating that the appropriate state has
been reached or the specified timeout has been reached.
Return:
the destination state for which the future is redeemed
Throws:
InterruptedException,TimeoutException
 

get
public ExecState get ()
 
redeems the executable state indicating that the appropriate state has
been reached
Return:
the destination state for which the future is redeemed
Throws:
InterruptedException
 

idle
public void idle (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the IDLE state
Parameters:
executable the ManagedExecutable whose state has changed
 

isCancelled
public boolean isCancelled ()
 
Return:
true if the future has been cancelled, false if the future has not been cancelled
 

isDone
public boolean isDone ()
 
Return:
true if the future has been redeemed, false if the future has not been redeemed
 

resuming
public void resuming (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the RESUMING state
Parameters:
executable the ManagedExecutable whose state has changed
 

running
public void running (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the RUNNING state
Parameters:
executable the ManagedExecutable whose state has changed
 

shuttingDown
public void shuttingDown (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the SHUTTINGDOWN state
Parameters:
executable the ManagedExecutable whose state has changed
 

starting
public void starting (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the STARTING state
Parameters:
executable the ManagedExecutable whose state has changed
 

stopping
public void stopping (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the STOPPING state
Parameters:
executable the ManagedExecutable whose state has changed
 

suspended
public void suspended (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the SUSPENDED state
Parameters:
executable the ManagedExecutable whose state has changed
 

suspending
public void suspending (ManagedExecutable executable)
 
indicates the specified ManagedExecutable has reached the SUSPENDING state
Parameters:
executable the ManagedExecutable whose state has changed
 

Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD