Class Monitor

java.lang.Object
org.eclipse.net4j.util.om.monitor.AbstractMonitor
org.eclipse.net4j.util.om.monitor.Monitor
All Implemented Interfaces:
OMMonitor, OMMonitorProgress
Direct Known Subclasses:
EclipseMonitor, NotifyingMonitor, TimeoutMonitor

public class Monitor extends AbstractMonitor
Since:
2.0
Author:
Eike Stepper
  • Field Details

    • DEFAULT_ASYNC_SCHEDULE_PERIOD

      public static final long DEFAULT_ASYNC_SCHEDULE_PERIOD
      See Also:
  • Constructor Details

    • Monitor

      public Monitor()
  • Method Details

    • cancel

      public void cancel()
    • cancel

      public void cancel(RuntimeException cancelException)
    • isCanceled

      public boolean isCanceled()
    • checkCanceled

      public void checkCanceled() throws MonitorCanceledException
      Throws:
      MonitorCanceledException
    • isCanceledState

      protected final boolean isCanceledState()
      Returns the cancellation flag without applying subclass-specific observation side effects.
      Returns:
      whether this monitor has been canceled
      Since:
      3.31
    • getAsyncSchedulePeriod

      protected long getAsyncSchedulePeriod()
      Specified by:
      getAsyncSchedulePeriod in class AbstractMonitor
    • scheduleAtFixedRate

      protected void scheduleAtFixedRate(TimerTask task, long delay, long period)
      Specified by:
      scheduleAtFixedRate in class AbstractMonitor
    • getTimer

      protected Timer getTimer()
      Specified by:
      getTimer in class AbstractMonitor
    • scheduleAtFixedRate

      public static TimerTask scheduleAtFixedRate(Runnable task, long delay, long period)
      Schedules a periodic task on the shared daemon timer used by monitors. Task failures are logged and do not terminate the timer thread. Scheduling failures are logged and leave the returned task unscheduled. Canceled tasks remain in the timer queue until their scheduled time is reached.
      Parameters:
      task - the task to run
      delay - the delay before the first execution in milliseconds
      period - the period between executions in milliseconds
      Returns:
      the scheduled task, which can be canceled to stop further executions
      Throws:
      NullPointerException - if task is null
      Since:
      3.31