Methods Summary |
---|
public abstract java.lang.Object | construct()Compute the value to be returned by the get method.
|
public void | finished()Called on the event dispatching thread (not on the worker thread)
after the construct method has returned.
|
public java.lang.Object | get()Return the value created by the construct method.
Returns null if either the constructing thread or the current
thread was interrupted before a value was produced.
while (true) {
Thread t = threadVar.get();
if (t == null) {
return getValue();
}
try {
t.join();
}
catch (InterruptedException e) {
Thread.currentThread().interrupt(); // propagate
return null;
}
}
|
protected synchronized java.lang.Object | getValue()Get the value produced by the worker thread, or null if it
hasn't been constructed yet.
return value;
|
public void | interrupt()A new method that interrupts the worker thread. Call this method
to force the worker to stop what it's doing.
Thread t = threadVar.get();
if (t != null) {
t.interrupt();
}
threadVar.clear();
|
private synchronized void | setValue(java.lang.Object x)Set the value produced by worker thread
value = x;
|
public void | start()Start the worker thread.
Thread t = threadVar.get();
if (t != null) {
t.start();
}
|