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
- the Controller posts a TransitionEvent indicating that it
has moved to the desired state, or
- the Controller posts a ControllerErrorEvent, indicating
that an error occurred andthe transition failed
-
StateWaiter(Controller)
- Construct a StateWaiter object for the given Controller
-
blockingPrefetch()
- Calls prefetch() on the Controller and blocks the current thread
until the Controller is Prefetched.
-
blockingRealize()
- Calls realize() on the Controller and blocks the current thread
until the Controller is Realized.
-
blockingStart()
- Casts the Controller to a Player, calls start(), and
blocks the current thread until the player is Started.
-
blockingSyncStart(Time)
- Calls syncStart() on the Controller and blocks the current thread
until the Controller is Started.
-
controllerUpdate(ControllerEvent)
- Listens for a transition to the state that this
StateWaiter is waiting for.
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
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:
- A TransitionEvent to the desired state is posted
- A StopEvent is posted
- A ControllerClosedEvent is posted (indicating
a failure)
- Parameters:
- event
- the media event
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.
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.
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
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