Style Intelligence v12.0

inetsoft.sree.schedule
Class Scheduler

java.lang.Object
  extended by inetsoft.sree.schedule.Scheduler

public class Scheduler
extends Object


Nested Class Summary
static class Scheduler.MulticastMessage
          Representation of a mutlicast message.
static class Scheduler.MulticastReceiveThread
          Listener thread that handles incoming multicast messages.
 
Field Summary
 inetsoft.util.DataChangeListener changeListener
          Listener added to be notified if the file on disk has changed.
static int HEARTBEAT_INTERVAL
          Scheduler Multicast heartbeat interval.
static int HEARTBEAT_MESSAGE
          Scheduler Multicast heartbeat message identifier.
static int LASTRUN_FAILED
          Status: a task has finished with failure.
static int LASTRUN_FINISHED
          Status: a task has finished successfully.
static int LASTRUN_INTERRUPTED
          Status: a task is interrupted because of system restart
static int LASTRUN_STARTED
          Status: a task has been started.
static int LOOPBACK_MESSAGE
          Scheduler Multicast loopback message identifier.
static int MESSAGE
          Plain message.
static String MULTICAST_ADDRESS
          Scheduler Multicast address.
static int MULTICAST_PORT
          Scheduler Multicast port.
static int NEXTRUN_DELETE
          Status: a task mark to be removed later by the execution thread.
static int NEXTRUN_IGNORED
          Status: the task's conditions are currently not satisfied and there is not a known retest interval for the task, may be the condition trigger is not existed.
static int NEXTRUN_PENDING
          Status: the task's conditions needs to be retested at a known time interval.
static int NEXTRUN_READY
          Status: a task is ready to run, but not started because of concurrency limit.
static int NEXTRUN_WAITTRIGGER
          Status: the task's conditions are currently not satisfied and there is not a known retest interval for the task.
static int PRIMARY_SEARCH_MESSAGE
          Scheduler Multicast primary search message identifier.
 
Method Summary
 String getID()
          Get the id of the scheduler node.
 String getPrimaryID()
          Get the id of the primary scheduler node.
static Scheduler getScheduler()
          Get the scheduler instance.
 boolean isPrimary()
          Returns true of this is the primary scheduler and it should be run.
 boolean isRunning()
          Determine if this scheduler instance is running.
 void restart()
           
 void run()
          Thread run method.
static void runNow(String taskName)
          Run the named task immediately.
 void setID(String identifier)
          Set the unique identifier for this scheduler.
 void setPrimaryID(String pid)
          Set the id of the primary scheduler.
 void setTaskReady(inetsoft.sree.schedule.Scheduler.TaskStatus taskStatus)
          Initializes the thread pools, making a task ready to run.
static void start()
          Start running a scheduler thread.
static void start(String id)
          Start running a scheduler thread.
static void stop()
          Stop scheduler process.
static void stopNow(String taskName)
          Stop the named task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LASTRUN_STARTED

public static final int LASTRUN_STARTED
Status: a task has been started.

See Also:
Constant Field Values

LASTRUN_FINISHED

public static final int LASTRUN_FINISHED
Status: a task has finished successfully.

See Also:
Constant Field Values

LASTRUN_FAILED

public static final int LASTRUN_FAILED
Status: a task has finished with failure.

See Also:
Constant Field Values

LASTRUN_INTERRUPTED

public static final int LASTRUN_INTERRUPTED
Status: a task is interrupted because of system restart

See Also:
Constant Field Values

NEXTRUN_PENDING

public static final int NEXTRUN_PENDING
Status: the task's conditions needs to be retested at a known time interval.

See Also:
Constant Field Values

NEXTRUN_READY

public static final int NEXTRUN_READY
Status: a task is ready to run, but not started because of concurrency limit.

See Also:
Constant Field Values

NEXTRUN_IGNORED

public static final int NEXTRUN_IGNORED
Status: the task's conditions are currently not satisfied and there is not a known retest interval for the task, may be the condition trigger is not existed.

See Also:
Constant Field Values

NEXTRUN_WAITTRIGGER

public static final int NEXTRUN_WAITTRIGGER
Status: the task's conditions are currently not satisfied and there is not a known retest interval for the task.

See Also:
Constant Field Values

NEXTRUN_DELETE

public static final int NEXTRUN_DELETE
Status: a task mark to be removed later by the execution thread.

See Also:
Constant Field Values

MESSAGE

public static final int MESSAGE
Plain message.

See Also:
Constant Field Values

MULTICAST_ADDRESS

public static final String MULTICAST_ADDRESS
Scheduler Multicast address.

See Also:
Constant Field Values

MULTICAST_PORT

public static final int MULTICAST_PORT
Scheduler Multicast port.

See Also:
Constant Field Values

HEARTBEAT_INTERVAL

public static final int HEARTBEAT_INTERVAL
Scheduler Multicast heartbeat interval.

See Also:
Constant Field Values

HEARTBEAT_MESSAGE

public static final int HEARTBEAT_MESSAGE
Scheduler Multicast heartbeat message identifier.

See Also:
Constant Field Values

PRIMARY_SEARCH_MESSAGE

public static final int PRIMARY_SEARCH_MESSAGE
Scheduler Multicast primary search message identifier.

See Also:
Constant Field Values

LOOPBACK_MESSAGE

public static final int LOOPBACK_MESSAGE
Scheduler Multicast loopback message identifier.

See Also:
Constant Field Values

changeListener

public inetsoft.util.DataChangeListener changeListener
Listener added to be notified if the file on disk has changed.

Method Detail

start

public static void start()
                  throws Exception
Start running a scheduler thread.

Throws:
Exception

start

public static void start(String id)
                  throws Exception
Start running a scheduler thread.

Throws:
Exception

stop

public static void stop()
                 throws Exception
Stop scheduler process. Running tasks are not explicitly controlled by scheduler once it's started. Since it's unsafe to call Thread.kill(), its not possible for scheduler to cleanly kill every thread. In order to have all running tasks terminated, calling process of this method should call System.exit().

Throws:
Exception

runNow

public static void runNow(String taskName)
                   throws Exception
Run the named task immediately.

Throws:
Exception

stopNow

public static void stopNow(String taskName)
                    throws Exception
Stop the named task.

Throws:
Exception

getScheduler

public static Scheduler getScheduler()
Get the scheduler instance.

Returns:
the scheduler instance.

setID

public void setID(String identifier)
Set the unique identifier for this scheduler.


getID

public String getID()
Get the id of the scheduler node.


getPrimaryID

public String getPrimaryID()
Get the id of the primary scheduler node.


setPrimaryID

public void setPrimaryID(String pid)
Set the id of the primary scheduler.


isPrimary

public boolean isPrimary()
Returns true of this is the primary scheduler and it should be run.


restart

public void restart()
             throws Exception
Throws:
Exception

run

public void run()
Thread run method. Starts up the Scheduler. Should call init() first to establish the environment the scheduler runs in.


setTaskReady

public void setTaskReady(inetsoft.sree.schedule.Scheduler.TaskStatus taskStatus)
Initializes the thread pools, making a task ready to run.

Parameters:
taskStatus - Object which needs to be added to the queue. Calling code should synchronize on the status parameter.

isRunning

public boolean isRunning()
Determine if this scheduler instance is running.

Returns:
true if the scheduler is running.

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.