public class SchedulerService extends Object implements Service
It uses a java.util.concurrent.ScheduledExecutorService.
The SCHEDULER_THREADS
configuration property indicates
how many threads the scheduler will use to run scheduled commands.
Modifier and Type | Class and Description |
---|---|
static class |
SchedulerService.Unit |
Modifier and Type | Field and Description |
---|---|
static String |
CONF_PREFIX |
static String |
SCHEDULER_THREADS |
DEFAULT_LOCK_TIMEOUT, lockTimeout
Constructor and Description |
---|
SchedulerService() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the scheduler service.
|
Class<? extends Service> |
getInterface()
Return the public interface for scheduler service.
|
int |
getSchedulableThreads(org.apache.hadoop.conf.Configuration conf)
Return the number of threads configured with the Scheduler Service
|
ScheduledExecutorService |
getScheduler()
Return the java.util.concurrent.ScheduledExecutorService instance used by the SchedulerService.
|
void |
init(Services services)
Initialize the scheduler service.
|
void |
schedule(Callable<Void> callable,
long delay,
long interval,
SchedulerService.Unit unit)
Schedule a Callable for execution.
|
void |
schedule(Runnable runnable,
long delay,
long interval,
SchedulerService.Unit unit)
Schedule a Runnable for execution.
|
void |
schedule(Runnable runnable,
long delay,
SchedulerService.Unit unit)
Schedule a Runnable for execution.
|
public static final String CONF_PREFIX
public static final String SCHEDULER_THREADS
public SchedulerService()
public void destroy()
public Class<? extends Service> getInterface()
getInterface
in interface Service
SchedulerService
.public ScheduledExecutorService getScheduler()
public int getSchedulableThreads(org.apache.hadoop.conf.Configuration conf)
conf
- public void schedule(Callable<Void> callable, long delay, long interval, SchedulerService.Unit unit)
callable
- callable to schedule for execution.delay
- delay for first execution since scheduling.interval
- interval between executions.unit
- scheduling unit.public void schedule(Runnable runnable, long delay, long interval, SchedulerService.Unit unit)
runnable
- Runnable to schedule for execution.delay
- delay for first execution since scheduling.interval
- interval between executions.unit
- scheduling unit.public void schedule(Runnable runnable, long delay, SchedulerService.Unit unit)
runnable
- Runnable to schedule for execution.delay
- the time from now to delay execution.unit
- scheduling unit.Copyright © 2018 Apache Software Foundation. All rights reserved.