Class ClockTickTimer


  • public class ClockTickTimer
    extends Timer
    This clock ticking timer extends the pausable timer.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2015 Created on Sep 07, 2015
    • Field Detail

      • clock

        @Autowired
        private Date clock
      • timerEventBus

        @Autowired
        @Qualifier("timerEventBus")
        private com.google.common.eventbus.AsyncEventBus timerEventBus
      • dayChanged

        private boolean dayChanged
      • lock

        private static java.lang.Object lock
        Lock for guaranteeing thread safety
    • Constructor Detail

      • ClockTickTimer

        public ClockTickTimer​(long interval,
                              long duration)
    • Method Detail

      • register

        @PostConstruct
        private void register()
      • unregister

        @PreDestroy
        private void unregister()
      • onTick

        protected void onTick()
        Description copied from class: Timer
        This method is called periodically with the interval set as the delay between subsequent calls.
        Specified by:
        onTick in class Timer
      • onFinish

        protected void onFinish()
        Description copied from class: Timer
        This method is called once the timer has run for the specified duration. If the duration was set as infinity, then this method is never called.
        Specified by:
        onFinish in class Timer
      • tick

        public void tick()
        Update the time by one tick.
      • handlePause

        public void handlePause​(PauseGame event)
      • handleResume

        public void handleResume​(ResumeGame event)