code: public final void initializeInternalTimer() {
          // if it is the first the instance is started, we initialize the
          // internal timer thread
          if (!internalTimerInitialized) {
  
              TimerTask internalTimerTask = new TimerTask() {
  
                  /**
                   * this method is triggered every TIMER_INTERVAL_MILLIS
                   */
                  @Override
                  public void run() {
  
                      if (terminated) {
                          running = false;
                          booting = false;
                          stopping = false;
                          pubDns = null;
                          this.cancel();
                          onTerminated();
                          return;
                      }
  
                      if (running) {
  
                          if (booting) {
  
                              // delay a random 'boot time'
                              if (MAX_BOOT_TIME_MILLS != 0) {
                                  try {
                                      Thread.sleep(MIN_BOOT_TIME_MILLS
                                              + random.nextInt((int) (MAX_BOOT_TIME_MILLS
                                                      - MIN_BOOT_TIME_MILLS)));
                                  } catch (InterruptedException e) {
                                      throw new AwsMockException(
                                              "InterruptedException caught when delaying a mock random 'boot time'",
                                              e);
                                  }
                              }
  
                              // booted, assign a mock pub dns name
                              pubDns = generatePubDns();
  
                              booting = false;
  
                              onBooted();
  
                          } else if (stopping) {
  
                              // delay a random 'shutdown time'
                              if (MAX_SHUTDOWN_TIME_MILLS != 0) {
                                  try {
                                      Thread.sleep(MIN_SHUTDOWN_TIME_MILLS
                                              + random.nextInt((int) (MAX_SHUTDOWN_TIME_MILLS
                                                      - MIN_SHUTDOWN_TIME_MILLS)));
                                  } catch (InterruptedException e) {
                                      throw new AwsMockException(
                                              "InterruptedException caught when delaying a mock random 'shutdown time'",
                                              e);
                                  }
                              }
  
                              // unset pub dns name
                              pubDns = null;
  
                              stopping = false;
  
                              running = false;
  
                              onStopped();
  
                          }
  
                          onInternalTimer();
  
                      }
  
                  }
              };
              timer = new SerializableTimer(true);
              timer.schedule(internalTimerTask, 0L, TIMER_INTERVAL_MILLIS);
  
              internalTimerInitialized = true;
          }
      }
docs: Start scheduling the internal timer that controls the behaviors and states of this mock ec2 instance.