Package org.pgcodekeeper.core.monitor
Interface IMonitor
- All Known Implementing Classes:
NullMonitor
public interface IMonitor
Interface for monitoring progress and cancellation of long-running operations.
Provides support for work progress tracking, cancellation state management,
and hierarchical monitoring through sub-monitors.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckCancelled(IMonitor monitor) Checks if progress monitor has been cancelled.Creates a sub-monitor for tracking a portion of this monitor's work.booleanReturns whether this monitor has been canceled.voidsetCanceled(boolean cancelled) Sets the cancellation state of this monitor.voidsetWorkRemaining(int size) Sets the number of work units remaining for this monitor.voidworked(int i) Notifies that a given number of work units have been completed.
-
Method Details
-
setCanceled
void setCanceled(boolean cancelled) Sets the cancellation state of this monitor.- Parameters:
cancelled-trueto cancel the operation,falseotherwise
-
isCanceled
boolean isCanceled()Returns whether this monitor has been canceled.- Returns:
trueif the operation has been canceled,falseotherwise
-
worked
void worked(int i) Notifies that a given number of work units have been completed.- Parameters:
i- the number of work units completed
-
createSubMonitor
IMonitor createSubMonitor()Creates a sub-monitor for tracking a portion of this monitor's work.- Returns:
- a new sub-monitor instance
-
setWorkRemaining
void setWorkRemaining(int size) Sets the number of work units remaining for this monitor.- Parameters:
size- the number of work units remaining
-
checkCancelled
Checks if progress monitor has been cancelled.- Parameters:
monitor- the progress monitor to check- Throws:
InterruptedException- if monitor is cancelled
-