Class TimedSession

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.logging.Logger logger  
      private java.util.Timer timer
      The timer that controls the session duration.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TimedSession​(java.lang.String key, long timeout)
      Protected constructor, we only really instantiate specific types of transactions.
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • timer

        private java.util.Timer timer
        The timer that controls the session duration.
    • Constructor Detail

      • TimedSession

        protected TimedSession​(java.lang.String key,
                               long timeout)
        Protected constructor, we only really instantiate specific types of transactions.
        Parameters:
        key - A unique key to lookup this transaction with.
        timeout - The timeout for the session.
    • Method Detail

      • complete

        protected abstract boolean complete​(boolean result)
        Complete this task with the given result. By default this will be called (with value == false) when the timer expires.
        Parameters:
        result - The result to complete the session with.
        Returns:
        The result of the session.
      • cancel

        protected void cancel()
        Cancel the timer task.
      • complete

        public boolean complete​(ChangeSet cs)
        All transaction types must implement a completion action. This is called by the controller at the end of turn to complete any sessions that have not yet completed, or if the controller gets the required response to complete the session.
        Overrides:
        complete in class Session
        Parameters:
        cs - A ChangeSet to update with changes that occur when completing this session.
        Returns:
        True if the session was already complete.