public abstract class ActiveMQScheduledComponent extends Object implements ActiveMQComponent, Runnable
Constructor and Description |
---|
ActiveMQScheduledComponent(long initialDelay,
long checkPeriod,
TimeUnit timeUnit,
boolean onDemand)
It creates a scheduled component that can trigger
Runnable.run() with a fixed checkPeriod on a configured executor . |
ActiveMQScheduledComponent(long checkPeriod,
TimeUnit timeUnit,
boolean onDemand)
It creates a scheduled component that can trigger
Runnable.run() with a fixed checkPeriod on a configured executor . |
ActiveMQScheduledComponent(ScheduledExecutorService scheduledExecutorService,
Executor executor,
long initialDelay,
long checkPeriod,
TimeUnit timeUnit,
boolean onDemand)
It creates a scheduled component that can trigger
Runnable.run() with a fixed checkPeriod on a configured executor . |
ActiveMQScheduledComponent(ScheduledExecutorService scheduledExecutorService,
Executor executor,
long checkPeriod,
TimeUnit timeUnit,
boolean onDemand)
It creates a scheduled component that can trigger
Runnable.run() with a fixed checkPeriod on a configured executor . |
Modifier and Type | Method and Description |
---|---|
void |
delay() |
long |
getInitialDelay() |
long |
getPeriod() |
protected ActiveMQThreadFactory |
getThreadFactory() |
TimeUnit |
getTimeUnit() |
boolean |
isStarted() |
ActiveMQScheduledComponent |
setInitialDelay(long initialDelay) |
ActiveMQScheduledComponent |
setInitialDelayAndPeriod(long initialDelay,
long period)
Useful to change a running schedule and avoid multiple restarts.
|
ActiveMQScheduledComponent |
setInitialDelayAndPeriod(long initialDelay,
long period,
TimeUnit timeUnit)
Useful to change a running schedule and avoid multiple restarts.
|
ActiveMQScheduledComponent |
setPeriod(long period) |
ActiveMQScheduledComponent |
setPeriod(long period,
TimeUnit unit) |
ActiveMQScheduledComponent |
setTimeUnit(TimeUnit timeUnit) |
void |
start() |
void |
stop() |
public ActiveMQScheduledComponent(ScheduledExecutorService scheduledExecutorService, Executor executor, long initialDelay, long checkPeriod, TimeUnit timeUnit, boolean onDemand)
Runnable.run()
with a fixed checkPeriod
on a configured executor
.scheduledExecutorService
- the ScheduledExecutorService
that periodically trigger Runnable.run()
on the configured executor
executor
- the Executor
that execute Runnable.run()
when triggeredinitialDelay
- the time to delay first executioncheckPeriod
- the delay between the termination of one execution and the start of the nexttimeUnit
- the time unit of the initialDelay
and checkPeriod
parametersonDemand
- if true
the task won't be scheduled on start()
, false
otherwisepublic ActiveMQScheduledComponent(ScheduledExecutorService scheduledExecutorService, Executor executor, long checkPeriod, TimeUnit timeUnit, boolean onDemand)
Runnable.run()
with a fixed checkPeriod
on a configured executor
.
The component created will have initialDelay
defaulted to checkPeriod
.
scheduledExecutorService
- the ScheduledExecutorService
that periodically trigger Runnable.run()
on the configured executor
executor
- the Executor
that execute Runnable.run()
when triggeredcheckPeriod
- the delay between the termination of one execution and the start of the nexttimeUnit
- the time unit of the initialDelay
and checkPeriod
parametersonDemand
- if true
the task won't be scheduled on start()
, false
otherwisepublic ActiveMQScheduledComponent(long initialDelay, long checkPeriod, TimeUnit timeUnit, boolean onDemand)
Runnable.run()
with a fixed checkPeriod
on a configured executor
.
This is useful for cases where we want our own scheduler executor: on start()
it will create a fresh new single-threaded ScheduledExecutorService
using getThreadFactory()
and getThisClassLoader()
, while on stop()
it will garbage it.
initialDelay
- the time to delay first executioncheckPeriod
- the delay between the termination of one execution and the start of the nexttimeUnit
- the time unit of the initialDelay
and checkPeriod
parametersonDemand
- if true
the task won't be scheduled on start()
, false
otherwisepublic ActiveMQScheduledComponent(long checkPeriod, TimeUnit timeUnit, boolean onDemand)
Runnable.run()
with a fixed checkPeriod
on a configured executor
.
This is useful for cases where we want our own scheduler executor.
The component created will have initialDelay
defaulted to checkPeriod
.
checkPeriod
- the delay between the termination of one execution and the start of the nexttimeUnit
- the time unit of the initialDelay
and checkPeriod
parametersonDemand
- if true
the task won't be scheduled on start()
, false
otherwisepublic void start()
start
in interface ActiveMQComponent
protected ActiveMQThreadFactory getThreadFactory()
public void delay()
public long getPeriod()
public ActiveMQScheduledComponent setPeriod(long period)
public ActiveMQScheduledComponent setPeriod(long period, TimeUnit unit)
public long getInitialDelay()
public ActiveMQScheduledComponent setInitialDelay(long initialDelay)
public ActiveMQScheduledComponent setInitialDelayAndPeriod(long initialDelay, long period)
public ActiveMQScheduledComponent setInitialDelayAndPeriod(long initialDelay, long period, TimeUnit timeUnit)
public TimeUnit getTimeUnit()
public ActiveMQScheduledComponent setTimeUnit(TimeUnit timeUnit)
public void stop()
stop
in interface ActiveMQComponent
public boolean isStarted()
isStarted
in interface ActiveMQComponent
Copyright © 2018 JBoss by Red Hat. All rights reserved.