/** * Resumes the update manager. */ public synchronized void resume() { // System.err.println("Resume: " + suspendCalled + " : " + running); // if (suspendCalled) { // UpdateManagerEvent ev = new UpdateManagerEvent // (this, null, null); // // FIXX: Must happen in a different thread! // fireEvent(suspendedDispatcher, ev); // fireEvent(resumedDispatcher, ev); // } if (updateRunnableQueue.getQueueState() != RunnableQueue.RUNNING) { updateRunnableQueue.resumeExecution(); } }
/** * Resumes the update manager. */ public synchronized void resume() { // System.err.println("Resume: " + suspendCalled + " : " + running); // if (suspendCalled) { // UpdateManagerEvent ev = new UpdateManagerEvent // (this, null, null); // // FIXX: Must happen in a different thread! // fireEvent(suspendedDispatcher, ev); // fireEvent(resumedDispatcher, ev); // } if (updateRunnableQueue.getQueueState() != RunnableQueue.RUNNING) { updateRunnableQueue.resumeExecution(); } }
/** * Resumes the update manager. */ public synchronized void resume() { // System.err.println("Resume: " + suspendCalled + " : " + running); // if (suspendCalled) { // UpdateManagerEvent ev = new UpdateManagerEvent // (this, null, null); // // FIXX: Must happen in a different thread! // fireEvent(suspendedDispatcher, ev); // fireEvent(resumedDispatcher, ev); // } if (updateRunnableQueue.getQueueState() != RunnableQueue.RUNNING) { updateRunnableQueue.resumeExecution(); } }
/** * Interrupts the manager tasks. */ public void interrupt() { Runnable r = new Runnable() { public void run() { synchronized (UpdateManager.this) { if (started) { dispatchSVGUnLoadEvent(); } else { running = false; scriptingEnvironment.interrupt(); updateRunnableQueue.getThread().halt(); } } } }; try { // Preempt to cancel the pending tasks updateRunnableQueue.preemptLater(r); updateRunnableQueue.resumeExecution(); // ensure runnable runs... } catch (IllegalStateException ise) { // Not running, which is probably ok since that's what we // wanted. Might be an issue if SVGUnload wasn't issued... } }
/** * Interrupts the manager tasks. */ public void interrupt() { Runnable r = new Runnable() { public void run() { synchronized (UpdateManager.this) { if (started) { dispatchSVGUnLoadEvent(); } else { running = false; scriptingEnvironment.interrupt(); updateRunnableQueue.getThread().halt(); } } } }; try { // Preempt to cancel the pending tasks updateRunnableQueue.preemptLater(r); updateRunnableQueue.resumeExecution(); // ensure runnable runs... } catch (IllegalStateException ise) { // Not running, which is probably ok since that's what we // wanted. Might be an issue if SVGUnload wasn't issued... } }
/** * Interrupts the manager tasks. */ public void interrupt() { Runnable r = new Runnable() { public void run() { synchronized (UpdateManager.this) { if (started) { dispatchSVGUnLoadEvent(); } else { running = false; scriptingEnvironment.interrupt(); updateRunnableQueue.getThread().halt(); } } } }; try { // Preempt to cancel the pending tasks updateRunnableQueue.preemptLater(r); updateRunnableQueue.resumeExecution(); // ensure runnable runs... } catch (IllegalStateException ise) { // Not running, which is probably ok since that's what we // wanted. Might be an issue if SVGUnload wasn't issued... } }
public void run() { boolean suspendp, waitp; int time; while (true) { try { synchronized (rand) { suspendp = rand.nextBoolean(); waitp = rand.nextBoolean(); time = rand.nextInt(500); } if (suspendp) { // 1/2 of the time suspend, 1/2 time wait, 1/2 the // time don't rq.suspendExecution(waitp); System.out.println("Suspended - " + (waitp?"Wait":"Later")); Thread.sleep(time/10); } else { // 1/2 the time resume rq.resumeExecution(); System.out.println("Resumed"); Thread.sleep(time); } } catch(InterruptedException ie) { } } } }