/** * Creates a new RunnableQueue started in a new thread. * @return a RunnableQueue which is guaranteed to have entered its * <code>run()</code> method. */ public static RunnableQueue createRunnableQueue() { RunnableQueue result = new RunnableQueue(); synchronized (result) { // Sync on the new object, so we can wait until the new // thread is ready to go. HaltingThread ht = new HaltingThread (result, "RunnableQueue-" + threadCount++); ht.setDaemon(true); ht.start(); while (result.getThread() == null) { try { result.wait(); } catch (InterruptedException ie) { } } } return result; }
/** * Creates a new RunnableQueue started in a new thread. * @return a RunnableQueue which is guaranteed to have entered its * <code>run()</code> method. */ public static RunnableQueue createRunnableQueue() { RunnableQueue result = new RunnableQueue(); synchronized (result) { // Sync on the new object, so we can wait until the new // thread is ready to go. HaltingThread ht = new HaltingThread (result, "RunnableQueue-" + threadCount++); ht.setDaemon(true); ht.start(); while (result.getThread() == null) { try { result.wait(); } catch (InterruptedException ie) { } } } return result; }
/** * Creates a new RunnableQueue started in a new thread. * @return a RunnableQueue which is guaranteed to have entered its * <code>run()</code> method. */ public static RunnableQueue createRunnableQueue() { RunnableQueue result = new RunnableQueue(); synchronized (result) { // Sync on the new object, so we can wait until the new // thread is ready to go. HaltingThread ht = new HaltingThread (result, "RunnableQueue-" + threadCount++); ht.setDaemon(true); ht.start(); while (result.getThread() == null) { try { result.wait(); } catch (InterruptedException ie) { } } } return result; }