Scheduling
Quick tasks
No one likes task id's, but everyone probably has tried to cancel a task within a runnable.... ehem final single index array int... Not pretty. Lets fix that for good.
package org.cyberpwn.phantom;
import org.cyberpwn.phantom.sync.Task;
import org.cyberpwn.phantom.sync.TaskLater;
public class Example
{
public Example()
{
//Schedule a repeating task.
new Task(0)
{
public void run()
{
//You can cancel it in here also
cancel();
//You can check if its running (this is for outside of here)
isRunning();
}
};
//Schedule a delayed task.
new TaskLater(20)
{
public void run()
{
//Bam (fires one second into the future)
}
};
}
}