-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
public abstract class ScheduledMonitor implements AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classScheduledMonitor.Companion
-
Field Summary
Fields Modifier and Type Field Description private DurationinitialDelayprivate DurationwatchIntervalprivate final ScheduledExecutorServiceexecutorprivate final BooleanautoClose
-
Constructor Summary
Constructors Constructor Description ScheduledMonitor(Duration initialDelay, Duration watchInterval, ScheduledExecutorService executor, Boolean autoClose)
-
Method Summary
Modifier and Type Method Description final DurationgetInitialDelay()final UnitsetInitialDelay(Duration initialDelay)final DurationgetWatchInterval()final UnitsetWatchInterval(Duration watchInterval)final ScheduledExecutorServicegetExecutor()final BooleangetAutoClose()final Unitstart(Duration initialDelay, Duration period, Function0<Unit> runnable)Starts the monitor at the given period with the specific runnable action Visible only for testing final Unitstart(Duration initialDelay, Duration period)Unitstart(Long period, TimeUnit unit)Starts the reporter polling at the given period. Unitstart(Long initialDelay, Long period, TimeUnit unit, Runnable runnable)Starts the reporter polling at the given period with the specific runnable action. Unitstart(Long initialDelay, Long period, TimeUnit unit)Starts the reporter polling at the given period. final Unitstart()abstract Unitwatch()Unitclose()-
-
Constructor Detail
-
ScheduledMonitor
ScheduledMonitor(Duration initialDelay, Duration watchInterval, ScheduledExecutorService executor, Boolean autoClose)
-
-
Method Detail
-
getInitialDelay
final Duration getInitialDelay()
-
setInitialDelay
final Unit setInitialDelay(Duration initialDelay)
-
getWatchInterval
final Duration getWatchInterval()
-
setWatchInterval
final Unit setWatchInterval(Duration watchInterval)
-
getExecutor
final ScheduledExecutorService getExecutor()
-
getAutoClose
final Boolean getAutoClose()
-
start
final Unit start(Duration initialDelay, Duration period, Function0<Unit> runnable)
Starts the monitor at the given period with the specific runnable action Visible only for testing
-
start
Unit start(Long period, TimeUnit unit)
Starts the reporter polling at the given period.
- Parameters:
period- the amount of time between pollsunit- the unit forperiod
-
start
@Synchronized() Unit start(Long initialDelay, Long period, TimeUnit unit, Runnable runnable)
Starts the reporter polling at the given period with the specific runnable action. Visible only for testing.
-
start
@Synchronized() Unit start(Long initialDelay, Long period, TimeUnit unit)
Starts the reporter polling at the given period.
- Parameters:
initialDelay- the time to delay the first executionperiod- the amount of time between pollsunit- the unit forperiodandinitialDelay
-
-
-
-