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 cancelled.voidsetCancelled(boolean cancelled) Sets the cancellation state of this monitor.voidsetTaskName(String name) Sets the name of the current task being monitored.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
-
setCancelled
void setCancelled(boolean cancelled) Sets the cancellation state of this monitor.- Parameters:
cancelled-trueto cancel the operation,falseotherwise
-
isCancelled
boolean isCancelled()Returns whether this monitor has been cancelled.- Returns:
trueif the operation has been cancelled,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
-
setTaskName
Sets the name of the current task being monitored.- Parameters:
name- the task name
-
checkCancelled
Checks if progress monitor has been cancelled.- Parameters:
monitor- the progress monitor to check- Throws:
InterruptedException- if monitor is cancelled
-