Class TimedEventListener
- java.lang.Object
-
- ch.sahits.game.openpatrician.event.handler.TimedEventListener
-
- Direct Known Subclasses:
SinkConcurrentsShipOrder
public abstract class TimedEventListener extends java.lang.Object
A timed event willexecute()
everything that matches the subscribed method before the deadline. Else the event is remove. This listener is added to the event queue.- Author:
- Andi Hotz, (c) Sahits GmbH, 2013 Created on Feb 24, 2013
-
-
Constructor Summary
Constructors Constructor Description TimedEventListener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
destroy()
Method that is executed before the event is removed from the queue because the deadline is elapsed.abstract boolean
execute()
Method that is executed if an appropriate event arrives within the timeline.void
setDeadline(java.time.LocalDateTime deadline)
Det the deadline until when the even should be executed.
-
-
-
Field Detail
-
deadline
protected java.time.LocalDateTime deadline
-
date
@Autowired protected Date date
-
-
Method Detail
-
setDeadline
public void setDeadline(java.time.LocalDateTime deadline)
Det the deadline until when the even should be executed.- Parameters:
deadline
- time when the event is executed
-
execute
public abstract boolean execute()
Method that is executed if an appropriate event arrives within the timeline.- Returns:
- true if the event was handled and the listener can be removed.
-
destroy
public void destroy()
Method that is executed before the event is removed from the queue because the deadline is elapsed. Subclasses should override this method.
-
-