--- a/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/control/Navigator.java Tue Sep 09 09:59:37 2008 -0400
+++ b/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/common/control/Navigator.java Tue Sep 09 10:07:11 2008 -0400
@@ -40,11 +40,24 @@
public static final String PATH_SEPARATOR = "/";
public static final String PARENT_ID = "..";
- // Use a thread pool to autmatically handle uncaught exceptions and queued
- // requests
- private static final ThreadPoolExecutor threadPool;
- static {
- ThreadFactory factory = new NamedThreadFactory("Navigator-");
+ //
+ // Instance data
+ //
+
+ private Thread dispatchThread;
+
+ // Use a thread pool with a single core thread to autmatically handle
+ // uncaught exceptions and queued requests
+ private ThreadPoolExecutor threadPool;
+ {
+ ThreadFactory factory =
+ new NamedThreadFactory("Navigator-") {
+ @Override
+ public Thread newThread(Runnable r) {
+ dispatchThread = super.newThread(r);
+ return dispatchThread;
+ }
+ };
// Unbounded
BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
@@ -55,10 +68,6 @@
threadPool.allowCoreThreadTimeOut(true);
}
- //
- // Instance data
- //
-
private StackList<Control> stack = new StackList<Control>();
private List<NavigationListener> listeners =
@@ -438,6 +447,15 @@
}
/**
+ * Determines whether the current thread is the navigation dispatch thread.
+ * The navigation dispatch thread may change over time, but only one is
+ * alive at a time.
+ */
+ public boolean isDispatchThread() {
+ return Thread.currentThread() == dispatchThread;
+ }
+
+ /**
* Returns the current {@link Control}.
*/
public Control peek() {