com.cubeia.firebase.api.scheduler
Interface Scheduler<T extends Action>

All Known Subinterfaces:
TableScheduler
All Known Implementing Classes:
AbstractScheduler, MttSchedulerImpl, TableSchedulerImpl

public interface Scheduler<T extends Action>

This object manages scheduled actions for a particular object. Using this interface scheduled actions can be associated with a table for later processing. It is important to remember to remove the scheduled action if it is canceled.

Author:
Lars J. Nilsson

Method Summary
 void cancelAllScheduledActions()
          This method safely cancel all scheduled actions in this scheduler.
 void cancelScheduledAction(java.util.UUID id)
           
 UnmodifiableSet<java.util.UUID> getAllScheduledGameActions()
           
 Action getScheduledGameAction(java.util.UUID id)
           
 long getScheduledGameActionDelay(java.util.UUID id)
           
 boolean hasScheduledGameAction(java.util.UUID id)
           
 java.util.UUID scheduleAction(T action, long delay)
           
 

Method Detail

hasScheduledGameAction

boolean hasScheduledGameAction(java.util.UUID id)
Parameters:
id - Id of action to check, must not be null
Returns:
True if there is an action with the id, false otherwise

getAllScheduledGameActions

UnmodifiableSet<java.util.UUID> getAllScheduledGameActions()
Returns:
The ids of all known scheduled actions, never null

getScheduledGameActionDelay

long getScheduledGameActionDelay(java.util.UUID id)
Parameters:
id - Task id, must not be null
Returns:
The delay in millis for a scheduled action, or -1 if not known

getScheduledGameAction

Action getScheduledGameAction(java.util.UUID id)
Parameters:
id - Task id, must not be null
Returns:
The scheduled action, or null if not found

scheduleAction

java.util.UUID scheduleAction(T action,
                              long delay)
Parameters:
action - Action to schedule, must not be null
delay - time in millis to wait until executing this action.
Returns:
a UUID for identifying the scheduled task

cancelScheduledAction

void cancelScheduledAction(java.util.UUID id)
Parameters:
id - Task id, must not be null

cancelAllScheduledActions

void cancelAllScheduledActions()
This method safely cancel all scheduled actions in this scheduler.



Copyright © 2011 Cubeia Ltd. All Rights Reserved.