@Override public final synchronized boolean pause() { if ( !isStarted() || pauseIssued ) { return false; } if(DEBUG) { System.err.println("FPSAnimator.pause() START: "+task+", "+ Thread.currentThread() + ": " + toString()); } final boolean res; if( null == task ) { // start/resume case w/ drawablesEmpty res = true; } else { pauseIssued = true; res = finishLifecycleAction(waitForPausedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); } if(DEBUG) { System.err.println("FPSAnimator.pause() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } if(null != task) { task.cancel(); task = null; } return res; } private final Condition waitForPausedCondition = new Condition() {
} else { stopIssued = true; res = finishLifecycleAction(waitForStoppedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION);
@Override public final synchronized boolean pause() { if ( !isStarted() || pauseIssued ) { return false; } if(DEBUG) { System.err.println("FPSAnimator.pause() START: "+task+", "+ Thread.currentThread() + ": " + toString()); } final boolean res; if( null == task ) { // start/resume case w/ drawablesEmpty res = true; } else { pauseIssued = true; res = finishLifecycleAction(waitForPausedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); } if(DEBUG) { System.err.println("FPSAnimator.pause() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } if(null != task) { task.cancel(); task = null; } return res; } private final Condition waitForPausedCondition = new Condition() {
@Override public final synchronized boolean pause() { if ( !isStarted() || pauseIssued ) { return false; } if(DEBUG) { System.err.println("FPSAnimator.pause() START: "+task+", "+ Thread.currentThread() + ": " + toString()); } final boolean res; if( null == task ) { // start/resume case w/ drawablesEmpty res = true; } else { pauseIssued = true; res = finishLifecycleAction(waitForPausedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); } if(DEBUG) { System.err.println("FPSAnimator.pause() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } if(null != task) { task.cancel(); task = null; } return res; } private final Condition waitForPausedCondition = new Condition() {
} else { stopIssued = true; res = finishLifecycleAction(waitForStoppedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION);
} else { stopIssued = true; res = finishLifecycleAction(waitForStoppedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION);
@Override public final synchronized boolean start() { if ( null != timer || null != task || isStarted() ) { return false; } timer = new Timer( getThreadName()+"-"+baseName+"-Timer"+(timerNo++) ); task = new MainTask(); if(DEBUG) { System.err.println("FPSAnimator.start() START: "+task+", "+ Thread.currentThread() + ": " + toString()); } task.start(timer); final boolean res = finishLifecycleAction( drawablesEmpty ? waitForStartedEmptyCondition : waitForStartedAddedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); if(DEBUG) { System.err.println("FPSAnimator.start() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } if( drawablesEmpty ) { task.cancel(); task = null; } return res; } private final Condition waitForStartedAddedCondition = new Condition() {
@Override public final synchronized boolean start() { if ( null != timer || null != task || isStarted() ) { return false; } timer = new Timer( getThreadName()+"-"+baseName+"-Timer"+(timerNo++) ); task = new MainTask(); if(DEBUG) { System.err.println("FPSAnimator.start() START: "+task+", "+ Thread.currentThread() + ": " + toString()); } task.start(timer); final boolean res = finishLifecycleAction( drawablesEmpty ? waitForStartedEmptyCondition : waitForStartedAddedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); if(DEBUG) { System.err.println("FPSAnimator.start() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } if( drawablesEmpty ) { task.cancel(); task = null; } return res; } private final Condition waitForStartedAddedCondition = new Condition() {
@Override public final synchronized boolean start() { if ( null != timer || null != task || isStarted() ) { return false; } timer = new Timer( getThreadName()+"-"+baseName+"-Timer"+(timerNo++) ); task = new MainTask(); if(DEBUG) { System.err.println("FPSAnimator.start() START: "+task+", "+ Thread.currentThread() + ": " + toString()); } task.start(timer); final boolean res = finishLifecycleAction( drawablesEmpty ? waitForStartedEmptyCondition : waitForStartedAddedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); if(DEBUG) { System.err.println("FPSAnimator.start() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } if( drawablesEmpty ) { task.cancel(); task = null; } return res; } private final Condition waitForStartedAddedCondition = new Condition() {
@Override public final synchronized boolean resume() { if ( !isStarted() || !pauseIssued ) { return false; } if(DEBUG) { System.err.println("FPSAnimator.resume() START: "+ Thread.currentThread() + ": " + toString()); } final boolean res; if( drawablesEmpty ) { res = true; } else { if( null != task ) { if( DEBUG ) { System.err.println("FPSAnimator.resume() Ops: !pauseIssued, but task != null: "+toString()); ExceptionUtils.dumpStack(System.err); } task.cancel(); task = null; } task = new MainTask(); task.start(timer); res = finishLifecycleAction(waitForResumeCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); } if(DEBUG) { System.err.println("FPSAnimator.resume() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } return res; } private final Condition waitForResumeCondition = new Condition() {
@Override public final synchronized boolean resume() { if ( !isStarted() || !pauseIssued ) { return false; } if(DEBUG) { System.err.println("FPSAnimator.resume() START: "+ Thread.currentThread() + ": " + toString()); } final boolean res; if( drawablesEmpty ) { res = true; } else { if( null != task ) { if( DEBUG ) { System.err.println("FPSAnimator.resume() Ops: !pauseIssued, but task != null: "+toString()); Thread.dumpStack(); } task.cancel(); task = null; } task = new MainTask(); task.start(timer); res = finishLifecycleAction(waitForResumeCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); } if(DEBUG) { System.err.println("FPSAnimator.resume() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } return res; } private final Condition waitForResumeCondition = new Condition() {
@Override public final synchronized boolean resume() { if ( !isStarted() || !pauseIssued ) { return false; } if(DEBUG) { System.err.println("FPSAnimator.resume() START: "+ Thread.currentThread() + ": " + toString()); } final boolean res; if( drawablesEmpty ) { res = true; } else { if( null != task ) { if( DEBUG ) { System.err.println("FPSAnimator.resume() Ops: !pauseIssued, but task != null: "+toString()); ExceptionUtils.dumpStack(System.err); } task.cancel(); task = null; } task = new MainTask(); task.start(timer); res = finishLifecycleAction(waitForResumeCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION); } if(DEBUG) { System.err.println("FPSAnimator.resume() END: "+task+", "+ Thread.currentThread() + ": " + toString()); } return res; } private final Condition waitForResumeCondition = new Condition() {