| java.lang.Object com.sun.midp.util.LiveTraceCallback
LiveTraceCallback | public class LiveTraceCallback implements LiveTraceListener(Code) | | Provides a rendezvous point and synchronous callback within a
LiveTraceListener. An instance of LiveTraceCallback is installed into a
LiveTracer tracepoint like any other LiveTraceListener. Once installed, the
LiveTrace code calls a listener here, which synchronously calls a callback
established by a test making a call to await(). If a callback isn't
available, the trace listener blocks until one becomes available. After the
callback returns, it is removed. Therefore, while the listener is active,
every trace point must be matched by a call to await(). Otherwise,
the thread being traced will block and all the tests will timeout.
Sample usage from an i3test:
tcb = new LiveTraceCallback();
targetObject.liveTracer.add(TRACE_TAG, tcb);
// initiate some operation that will eventually hit TRACE_TAG
assertTrue(
"trace point was hit",
tcb.await(
new Runnable() {
public void run() {
// stuff executed by the traced thread
}
})
);
|
Method Summary | |
public synchronized boolean | await(Runnable r, long timeout) Blocks until a tracepoint is reached, causes r.run() to be called
synchronously by the traced thraed, and then lets both the traced
thread and the caller continue. | public boolean | await(Runnable r) Same as await(r, DEFAULT_TIMEOUT). | public boolean | await() Same as await(do nothing, DEFAULT_TIMEOUT). | public synchronized void | call(String tag) Called by Display's LiveTracer object after a screen change occurs. | public synchronized void | shutdown() Shuts down this trace listener by arranging for any listener not to
block and instead to be ignored. |
DEFAULT_TIMEOUT | final public static long DEFAULT_TIMEOUT(Code) | | The default timeout period, in milliseconds.
|
await | public synchronized boolean await(Runnable r, long timeout)(Code) | | Blocks until a tracepoint is reached, causes r.run() to be called
synchronously by the traced thraed, and then lets both the traced
thread and the caller continue. Times out after the indicated timeout
period. If a timeout or interrupt occurs, the callback is cleared
without being called.
Parameters: r - the Runnable whose run() method is to be called Parameters: timeout - timeout period in milliseconds true if the tracepoint was handled normally, false if a timeout or interrupt occurred |
await | public boolean await(Runnable r)(Code) | | Same as await(r, DEFAULT_TIMEOUT).
|
await | public boolean await()(Code) | | Same as await(do nothing, DEFAULT_TIMEOUT).
|
call | public synchronized void call(String tag)(Code) | | Called by Display's LiveTracer object after a screen change occurs.
|
shutdown | public synchronized void shutdown()(Code) | | Shuts down this trace listener by arranging for any listener not to
block and instead to be ignored. Any blocked listener is unblocked
and returns without calling the callback, even if one was currently
installed.
|
|
|