org.apache.oozie.service
Class SchedulerService

java.lang.Object
  extended by org.apache.oozie.service.SchedulerService
All Implemented Interfaces:
Service

public class SchedulerService
extends Object
implements Service

This service executes scheduled Runnables and Callables at regular intervals.

It uses a java.util.concurrent.ScheduledExecutorService.

The SCHEDULER_THREADS configuration property indicates how many threads the scheduler will use to run scheduled commands.


Nested Class Summary
static class SchedulerService.Unit
           
 
Field Summary
static String CONF_PREFIX
           
static String SCHEDULER_THREADS
           
 
Fields inherited from interface org.apache.oozie.service.Service
DEFAULT_LOCK_TIMEOUT, lockTimeout, USE_XCOMMAND
 
Constructor Summary
SchedulerService()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONF_PREFIX

public static final String CONF_PREFIX
See Also:
Constant Field Values

SCHEDULER_THREADS

public static final String SCHEDULER_THREADS
See Also:
Constant Field Values
Constructor Detail

SchedulerService

public SchedulerService()
Method Detail

init

public void init(Services services)
Initialize the scheduler service.

Specified by:
init in interface Service
Parameters:
services - services instance.

destroy

public void destroy()
Destroy the scheduler service.

Specified by:
destroy in interface Service

getInterface

public Class<? extends Service> getInterface()
Return the public interface for scheduler service.

Specified by:
getInterface in interface Service
Returns:
SchedulerService.

getScheduler

public ScheduledExecutorService getScheduler()
Return the java.util.concurrent.ScheduledExecutorService instance used by the SchedulerService.

Returns:
the scheduled executor service instance.

getSchedulableThreads

public int getSchedulableThreads(org.apache.hadoop.conf.Configuration conf)
Return the number of threads configured with the Scheduler Service

Parameters:
conf -
Returns:
int num threads

schedule

public void schedule(Callable<Void> callable,
                     long delay,
                     long interval,
                     SchedulerService.Unit unit)
Schedule a Callable for execution.

Parameters:
callable - callable to schedule for execution.
delay - delay for first execution since scheduling.
interval - interval between executions.
unit - scheduling unit.

schedule

public void schedule(Runnable runnable,
                     long delay,
                     long interval,
                     SchedulerService.Unit unit)
Schedule a Runnable for execution.

Parameters:
runnable - Runnable to schedule for execution.
delay - delay for first execution since scheduling.
interval - interval between executions.
unit - scheduling unit.

schedule

public void schedule(Runnable runnable,
                     long delay,
                     SchedulerService.Unit unit)
Schedule a Runnable for execution.

Parameters:
runnable - Runnable to schedule for execution.
delay - the time from now to delay execution.
unit - scheduling unit.


Copyright © 2013 Apache Software Foundation. All Rights Reserved.