public void cancel ( ) { final OnCancelListener listener ; synchronized ( this ) { if ( mIsCanceled ) { return ; } mIsCanceled = true ; mCancelInProgress = true ; listener = mOnCancelListener ; } try { if ( listener != null ) { listener . onCancel ( ) ; } } finally { synchronized ( this ) { mCancelInProgress = false ; notifyAll ( ) ; } } }
Cancels the operation and signals the cancellation listener . If the operation has not yet started then it will be canceled as soon as it does .