Class TimedEventListener

  • Direct Known Subclasses:
    SinkConcurrentsShipOrder

    public abstract class TimedEventListener
    extends java.lang.Object
    A timed event will execute() 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Date date  
      protected java.time.LocalDateTime deadline  
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • deadline

        protected java.time.LocalDateTime deadline
      • date

        @Autowired
        protected Date date
    • Constructor Detail

      • TimedEventListener

        public TimedEventListener()
    • 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.