|
What this is
Other links
The source code
package org.jext.misc;
import javax.swing.SwingUtilities;
/**
* This class comes from the SwingWorker class described at the URL below(3rd version), but has substantially changed;
* http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
*
*/
public abstract class SwingWorker {
private Object value; // see getValue(), setValue()
private Throwable exception;
private Thread thread;
protected HandlingRunnable notifier;
/**
* Class to maintain reference to current worker thread
* under separate synchronization control.
*/
private static class ThreadVar {
private Thread thread;
ThreadVar(Thread t) { thread = t; }
synchronized Thread get() { return thread; }
synchronized void clear() { thread = null; }
}
private ThreadVar threadVar;
/**
* Get the value produced by the worker thread, or null if it
* hasn't been constructed yet.
*/
public synchronized Object getValue() {
return value;
}
/**
* Set the value produced by worker thread
*/
private synchronized void setValue(Object x) {
value = x;
}
/**
* Get the value produced by the worker thread, or null if it
* hasn't been constructed yet.
*/
public synchronized Throwable getException() {
return exception;
}
/**
* Set the value produced by worker thread
*/
private synchronized void setException(Throwable x) {
exception = x;
}
/**
* Compute the value to be returned by the
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.