All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ejmf.toolkit.util.StateWaiter

java.lang.Object
   |
   +----ejmf.toolkit.util.StateWaiter

public class StateWaiter
extends Object
implements ControllerListener
The StateWaiter class provides routines to allow the current thread to wait for a Controller to reach a particular state. A StateWaiter object will first register itself as a ControllerListener on the given Controller object. It will then set the state to be waited for, and block the current thread until either


Constructor Index

 o StateWaiter(Controller)
Construct a StateWaiter object for the given Controller

Method Index

 o blockingPrefetch()
Calls prefetch() on the Controller and blocks the current thread until the Controller is Prefetched.
 o blockingRealize()
Calls realize() on the Controller and blocks the current thread until the Controller is Realized.
 o blockingStart()
Casts the Controller to a Player, calls start(), and blocks the current thread until the player is Started.
 o blockingSyncStart(Time)
Calls syncStart() on the Controller and blocks the current thread until the Controller is Started.
 o controllerUpdate(ControllerEvent)
Listens for a transition to the state that this StateWaiter is waiting for.

Constructors

 o StateWaiter
 public StateWaiter(Controller controller)
Construct a StateWaiter object for the given Controller

Parameters:
controller - the Controller on which to wait for the desired state

Methods

 o controllerUpdate
 public synchronized void controllerUpdate(ControllerEvent event)
Listens for a transition to the state that this StateWaiter is waiting for. Notifies the the waiting thread and stops listening if any of the following occur:

Parameters:
event - the media event
 o blockingRealize
 public boolean blockingRealize()
Calls realize() on the Controller and blocks the current thread until the Controller is Realized.

Returns:
boolean indicating whether the transition was successful.
 o blockingPrefetch
 public boolean blockingPrefetch()
Calls prefetch() on the Controller and blocks the current thread until the Controller is Prefetched.

Returns:
boolean indicating whether the transition was successful.
 o blockingStart
 public boolean blockingStart()
Casts the Controller to a Player, calls start(), and blocks the current thread until the player is Started.

Returns:
boolean indicating whether the transition was successful.
Throws: ClassCastException
If the Controller is not a Player
 o blockingSyncStart
 public boolean blockingSyncStart(Time t)
Calls syncStart() on the Controller and blocks the current thread until the Controller is Started. This could throw a ClockStartedError if the Controller is not in the Prefetched state.

Returns:
boolean indicating whether the transition was successful.

All Packages  Class Hierarchy  This Package  Previous  Next  Index