Package org.spongepowered.api.scheduler
Interface Scheduler
- 
 public interface SchedulerRepresents a scheduler for runningtasks.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description TaskExecutorServiceexecutor(org.spongepowered.plugin.PluginContainer plugin)Gets anexecutorthat can be used to schedule tasks through the standard Java concurrency interfaces.Optional<ScheduledTask>findTask(UUID id)Retrieves a scheduled or running task by its unique ID.Set<ScheduledTask>findTasks(String pattern)Returns a set ofTasks that match the Regular Expression pattern.ScheduledTasksubmit(Task task)Submit aTaskto this scheduler and returns the task as aScheduledTask.ScheduledTasksubmit(Task task, String name)Set<ScheduledTask>tasks()Returns a set of all currently scheduled tasks.Set<ScheduledTask>tasks(org.spongepowered.plugin.PluginContainer plugin)Returns a set of all currently scheduled tasks owned by the given plugin.
 
- 
- 
- 
Method Detail- 
findTaskOptional<ScheduledTask> findTask(UUID id) Retrieves a scheduled or running task by its unique ID.- Parameters:
- id- The id of the task
- Returns:
- The scheduled or running task, or Optional.empty()
 
 - 
findTasksSet<ScheduledTask> findTasks(String pattern) Returns a set ofTasks that match the Regular Expression pattern.- Parameters:
- pattern- The regular expression pattern applied to the name of tasks
- Returns:
- A set of Tasks that have names that match the pattern, the set will be empty if no names match
 
 - 
tasksSet<ScheduledTask> tasks(org.spongepowered.plugin.PluginContainer plugin) Returns a set of all currently scheduled tasks owned by the given plugin.- Parameters:
- plugin- The plugin that created the tasks
- Returns:
- A set of scheduled tasks
 
 - 
tasksSet<ScheduledTask> tasks() Returns a set of all currently scheduled tasks.- Returns:
- A set of scheduled tasks
 
 - 
executorTaskExecutorService executor(org.spongepowered.plugin.PluginContainer plugin) Gets anexecutorthat can be used to schedule tasks through the standard Java concurrency interfaces.- Parameters:
- plugin- The plugin that will own the created tasks
- Returns:
- An executor that can be used to execute tasks
 
 - 
submitScheduledTask submit(Task task) Submit aTaskto this scheduler and returns the task as aScheduledTask.The name of the task will be the form: 
 PLUGIN_ID "-" ( "A-" | "S-" ) SERIAL_IDExamples of default Task names: 
 "FooPlugin-A-12""BarPlugin-S-4322"No two active tasks will have the same serial ID for the same synchronisation type. 
 i.eAPlugin-A-15andBPlugin-A-15is not possible butBPlugin-S-15is.- Parameters:
- task- The task
- Returns:
- The scheduled task
 
 - 
submitScheduledTask submit(Task task, String name) - Parameters:
- task- The task
- name- The name
- Returns:
- The scheduled task
 
 
- 
 
-