/** * Returns the result of calling hasBeenHalted on * <code>Thread.currentThread()</code>, if it is an instance of * HaltingThread otherwise it returns false. */ public static boolean hasBeenHalted() { return hasBeenHalted(Thread.currentThread()); }
private void haltProgressivePaintThread() { if (progressivePaintThread != null) { progressivePaintThread.halt(); progressivePaintThread = null; } }
/** * 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; }
progressivePaintThread.setPriority(Thread.MIN_PRIORITY + 1); progressivePaintThread.start();
/** * Calls 'halt' on <code>Thread.currentThread()</code> if it is an * instance of HaltingThread otherwise it does nothing. */ public static void haltThread() { haltThread(Thread.currentThread()); }
/** * Returns the result of calling hasBeenHalted on <code>t</code>, * if it is an instance of HaltingThread otherwise it returns false. */ public static boolean hasBeenHalted(Thread t) { if (t instanceof HaltingThread) return ((HaltingThread)t).isHalted(); return false; }
progressivePaintThread.setPriority(Thread.MIN_PRIORITY + 1); progressivePaintThread.start();
/** * Calls 'halt' on <code>Thread.currentThread()</code> if it is an * instance of HaltingThread otherwise it does nothing. */ public static void haltThread() { haltThread(Thread.currentThread()); }
/** * Returns the result of calling hasBeenHalted on <code>t</code>, * if it is an instance of HaltingThread otherwise it returns false. */ public static boolean hasBeenHalted(Thread t) { if (t instanceof HaltingThread) return ((HaltingThread)t).isHalted(); return false; }
/** * Returns the result of calling hasBeenHalted on * <code>Thread.currentThread()</code>, if it is an instance of * HaltingThread otherwise it returns false. */ public static boolean hasBeenHalted() { return hasBeenHalted(Thread.currentThread()); }
/** * Calls 'halt' on <code>t</code> if it is an instance of * HaltingThread otherwise it does nothing. */ public static void haltThread(Thread t) { if (t instanceof HaltingThread) ((HaltingThread)t).halt(); }
/** * 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; }
progressivePaintThread.setPriority(Thread.MIN_PRIORITY + 1); progressivePaintThread.start();
/** * Calls 'halt' on <code>Thread.currentThread()</code> if it is an * instance of HaltingThread otherwise it does nothing. */ public static void haltThread() { haltThread(Thread.currentThread()); }
/** * Returns the result of calling hasBeenHalted on <code>t</code>, * if it is an instance of HaltingThread otherwise it returns false. */ public static boolean hasBeenHalted(Thread t) { if (t instanceof HaltingThread) return ((HaltingThread)t).isHalted(); return false; }
/** * Returns the result of calling hasBeenHalted on * <code>Thread.currentThread()</code>, if it is an instance of * HaltingThread otherwise it returns false. */ public static boolean hasBeenHalted() { return hasBeenHalted(Thread.currentThread()); }
/** * Calls 'halt' on <code>t</code> if it is an instance of * HaltingThread otherwise it does nothing. */ public static void haltThread(Thread t) { if (t instanceof HaltingThread) ((HaltingThread)t).halt(); }
/** * 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; }
/** * Paints this node without applying Filter, Mask, Composite, and clip. * * @param g2d the Graphics2D to use */ public void primitivePaint(Graphics2D g2d) { if (count == 0) { return; } // Thread.currentThread() is potentially expensive, so reuse my instance in hasBeenHalted() Thread currentThread = Thread.currentThread(); // Paint children for (int i=0; i < count; ++i) { if (HaltingThread.hasBeenHalted( currentThread )) return; GraphicsNode node = children[i]; if (node == null) { continue; } node.paint(g2d); } }
private void haltProgressivePaintThread() { if (progressivePaintThread != null) { progressivePaintThread.halt(); progressivePaintThread = null; } }