jklustor-all-api-0.0.7-20140619012755 (ChemAxon)


com.chemaxon.calculations.common
Class ProgressObservers

Object
  extended by com.chemaxon.calculations.common.ProgressObservers

@Beta
public final class ProgressObservers
extends Object

Utility functions for the creation of ProgressObservers.

Please note that this class is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.

Author:
Gabor Imre

Nested Class Summary
static class ProgressObservers.CancelObserverImpl
          Implementation of CancelObserver.
static interface ProgressObservers.PollingCanceller
          Interface exposing only a polling method to delegate cancel status events.
 
Method Summary
static SubProgressObserver createForgivingNullObserver()
          Returns a forgiving observer which wont enforce API contracts.
static SubProgressObserver createForgivingNullObserver(ProgressObservers.PollingCanceller canceller)
          Returns a forgiving cancellable observer which wont enforce API contracts.
static CancelObserver createNoCancelObserver()
          Returns a cancel observer which wont cancel execution.
static SubProgressObserver createNullObserver(String taskName)
          Returns a SubProgressObserver which ignores observed data.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createNullObserver

public static SubProgressObserver createNullObserver(String taskName)
Returns a SubProgressObserver which ignores observed data.

API contract is still enforced, eg. IllegalStateException is thrown on API contract breaches from the observed code.

Parameters:
taskName - Name of observed subtask
Returns:
A ProgressObserver with no query functionality.

createNoCancelObserver

public static CancelObserver createNoCancelObserver()
Returns a cancel observer which wont cancel execution.

Returns:
A canceller which wont cancel

createForgivingNullObserver

public static SubProgressObserver createForgivingNullObserver()
Returns a forgiving observer which wont enforce API contracts.

Returns:
A SubProgressObserver which wont enforce API contracts and wont cancel

createForgivingNullObserver

public static SubProgressObserver createForgivingNullObserver(ProgressObservers.PollingCanceller canceller)
Returns a forgiving cancellable observer which wont enforce API contracts.

Note that current implementation polls cancelling upon method calls. If an observed code expects cancelling only through listener callbacks and wont call other methods (progress update) cancel event wont be generated.

Parameters:
canceller - Underlying canceller polled at every operation
Returns:
A SubProgressObserver which wont enforce API contracts and propagates cancellinkg

jklustor-all-api-0.0.7-20140619012755 (ChemAxon)