Package com.chemaxon.clustering.common
Interface PhasedProgressObserver
- All Superinterfaces:
AutoCloseable
,ProgressObserver
Observer for reporting the progress of long-running tasks.
Design aspects of this progress observing facility:
- The execution observed is divided into phases.
- Each phase is started with a call to
phase(String)
, which returns a progress observer that monitors the progress of the phase. - Observers are also used for cancellation reporting. Since it is a cross-cutting concern, it is exposed as a separate, but extended interface.
Thread-safety: implementations are not required to be thread-safe. Observed processes must be prepared for working with non-thread-safe observers. Consequently, observer methods can be called only on the thread that invoked the observed function. Alternatively, proper synchronization must be ensured by the observed code.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Notifies that the represented task has completed (either successfully or because of a failure), and no further work will be done.static PhasedProgressObserver
Returns an observer that ignores progress report and cannot be cancelled.Called when a new phase is started, returns a progress observer that should be used in this phase.Methods inherited from interface chemaxon.util.progress.ProgressObserver
done, isCancelled, subTask, switchToDeterminate, worked, workUnit
-
Method Details
-
nullObserver
Returns an observer that ignores progress report and cannot be cancelled.- Returns:
- a null observer
-
phase
Called when a new phase is started, returns a progress observer that should be used in this phase.- Parameters:
name
- the name of the phase- Returns:
- the observer that should be notified about the progress of the new phase
-
close
default void close()Notifies that the represented task has completed (either successfully or because of a failure), and no further work will be done.Repeated calls to this method has no effect (idempotency).
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceProgressObserver
-