|
JSR-043: JTAPI-1.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Asynchronous version of the MediaEvent. Methods aupported by asynchronous events. Other Async Event interfaces extend from this.
An Async.Event [that is, a transaction] has methods:
isDone(); // test for done-ness waitForEventDone(); // wait until isDone() waitForListenersDone(); // wait until isDone() and Listeners have returned getException(); // test failure/success
The MediaEvent methods getEventID and getSource() (and various flavors of it) immediately return the requested value.
Note: getException() and any accessor for the results of an operation (for example, getError(), ResourceEvent.getQualifier() or BindToCallEvent.getCall()) first waits for the event to complete (using waitForEventDone()), and then return the requested value. If you do not want to wait, then test first using isDone() to see if the event is complete.
Implementation Note: The Event's source is an MPI.Owner: a MediaService, ContainerService, etc. When an Async.Event completes, a notification is sent to the Event's source using (MPI.Owner).onEventDone(). The owner dispatches the event to any Listeners. See the MPI for more details.
Fields inherited from interface javax.telephony.media.MediaConstants |
e_OK, q_Duration, q_Standard, q_Stop |
Method Summary | |
boolean |
isDone()
Indicates whether this Event has completed. |
void |
throwIfRuntimeException()
waitForListenersDone() and then throw a RuntimeException, if any. |
void |
waitForEventDone()
Wait for this asynchronous event to complete. |
void |
waitForEventDone(long msecs)
Waits at most msecs for this event to complete. |
void |
waitForListenersDone()
Wait for this event to complete and Listeners to complete. |
Methods inherited from interface javax.telephony.media.MediaEvent |
getError, getEventID, getException, getPayload, getQualifier, getSubError, getWarning |
Method Detail |
public boolean isDone()
public void waitForEventDone()
Note: to get direct access to any InterruptedException use waitForEventDone(long) instead.
a
- RuntimeException
if another thread interrupts the current thread.
That is, any InterruptedException is wrapped in
a RuntimeException.public void waitForEventDone(long msecs) throws java.lang.InterruptedException
Implements Async.Event
msecs
- the time to wait in milliseconds,
msecs = 0 means wait forever.java.lang.InterruptedException
- if another thread has interrupted
the current thread. The interrupted status of the
current thread is cleared when this Exception is thrown.public void waitForListenersDone()
This method is used by the synchronous API to wait for Listeners to complete before continuing the "main" thread.
a
- RuntimeException
if another thread interrupts the current thread.
That is, any InterruptedException is wrapped in
a RuntimeException.public void throwIfRuntimeException() throws java.lang.RuntimeException
Note: other events define methods to throw other classes of Exceptions, and those methods invoke this one internally. Therefore all the throwIf() methods waitForListenersDone, and also throw any RuntimeException in the event.
java.lang.RuntimeException
- if the event holds a RuntimeException.
|
JSR-043: JTAPI-1.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |