me.escapeNT.pail.scheduler
Class ServerTask

java.lang.Object
  extended by me.escapeNT.pail.scheduler.ServerTask
All Implemented Interfaces:
Serializable, ScheduledTask

public class ServerTask
extends Object
implements ScheduledTask

Class representing a scheduled server task.

Author:
escapeNT
See Also:
Serialized Form

Nested Class Summary
static class ServerTask.Type
          The type of server task to execute.
 
Constructor Summary
ServerTask(ServerTask.Type type, boolean repeating, long interval, String name)
          Constructs a new Server task of the given type.
 
Method Summary
 void execute()
          Executes this task.
 long getInterval()
          Gets the time interval between executions of this task.
 String getName()
          Gets the name of the specific task.
 boolean isEnabled()
          Gets whether the task is enabled and running.
 boolean isRepeating()
          Returns true if the task should be repeated indefinitely.
 void setEnabled(boolean enabled)
          Sets whether the task is enabled and running.
 void setName(String name)
          Sets the task name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerTask

public ServerTask(ServerTask.Type type,
                  boolean repeating,
                  long interval,
                  String name)
Constructs a new Server task of the given type.

Parameters:
type - The Type of server task.
repeating - True if the task is repeating.
interval - The interval (or delay) between executions.
Method Detail

getInterval

public long getInterval()
Description copied from interface: ScheduledTask
Gets the time interval between executions of this task.

Specified by:
getInterval in interface ScheduledTask
Returns:
The interval in milliseconds between task executions.

isRepeating

public boolean isRepeating()
Description copied from interface: ScheduledTask
Returns true if the task should be repeated indefinitely.

Specified by:
isRepeating in interface ScheduledTask
Returns:
True if the task is repeating, false if not.

execute

public void execute()
Description copied from interface: ScheduledTask
Executes this task.

Specified by:
execute in interface ScheduledTask

isEnabled

public boolean isEnabled()
Description copied from interface: ScheduledTask
Gets whether the task is enabled and running.

Specified by:
isEnabled in interface ScheduledTask
Returns:
True if the task is enabled.

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: ScheduledTask
Sets whether the task is enabled and running.

Specified by:
setEnabled in interface ScheduledTask
Parameters:
enabled - True if the task will be enabled, false if disabled.

getName

public String getName()
Description copied from interface: ScheduledTask
Gets the name of the specific task.

Specified by:
getName in interface ScheduledTask
Returns:
the name

setName

public void setName(String name)
Description copied from interface: ScheduledTask
Sets the task name.

Specified by:
setName in interface ScheduledTask
Parameters:
name - the name to set


Copyright © 2011. All Rights Reserved.