GemFire 5.5.1

com.gemstone.gemfire
Class CancelCriterion

java.lang.Object
  extended by com.gemstone.gemfire.CancelCriterion

public abstract class CancelCriterion
extends Object

Abstract cancellation proxy for cancelling an operation, esp. a thread.

See Also:
ThreadInterruptedException

Constructor Summary
CancelCriterion()
           
 
Method Summary
abstract  String cancelInProgress()
          Indicate if the service is in the progress of being cancelled.
abstract  String cancelled()
          Indicates that the service has terminated.
 void checkCancelInProgress(Throwable e)
          See if the current operation is being cancelled.
 void checkCancelled()
          See if the current operation has been cancelled.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CancelCriterion

public CancelCriterion()
Method Detail

cancelInProgress

public abstract String cancelInProgress()
Indicate if the service is in the progress of being cancelled. The typical use of this is to indicate, in the case of an InterruptedException, that the current operation should be cancelled.

In particular, a DistributionManager returns a non-null result if message distribution has been terminated.

Returns:
null if the service is not shutting down

cancelled

public abstract String cancelled()
Indicates that the service has terminated. The typical use of this is to poll within long loops to determine if the service has been terminated.

Returns:
a String to be used in an exception message, or null if it is not OK to cancel

checkCancelled

public final void checkCancelled()
                          throws ShutdownException
See if the current operation has been cancelled. If it has, throw a ShutdownException TODO: change to throws CancelledException instead

Throws:
ShutdownException - if we have been cancelled
See Also:
cancelled()

checkCancelInProgress

public final void checkCancelInProgress(Throwable e)
                                 throws ThreadInterruptedException
See if the current operation is being cancelled. If so, it either throws a ThreadInterruptedException or a ShutdownException. It throws the former only if the thread is currently in an interrupted state. TODO: change to throws CancelledException instead

Parameters:
e - an underlying exception, if any
Throws:
ThreadInterruptedException
ShutdownException
See Also:
cancelInProgress()

GemFire 5.5.1

Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.