hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
private void start() throws IOException {
    long now = 0;

    container.start();
    initCommandHandlerThread(conf);
    while (context.getState() != DatanodeStates.SHUTDOWN) {
      try {
        LOG.debug("Executing cycle Number : {}", context.getExecutionCount());
        nextHB.set(Time.monotonicNow() + heartbeatFrequency);
        context.setReportState(container.getNodeReport());
        context.setContainerReportState(container.getContainerReportState());
        context.execute(executorService, heartbeatFrequency,
            TimeUnit.MILLISECONDS);
        now = Time.monotonicNow();
        if (now < nextHB.get()) {
          Thread.sleep(nextHB.get() - now);
        }
      } catch (InterruptedException e) {
        // Ignore this exception.
      } catch (Exception e) {
        LOG.error("Unable to finish the execution.", e);
      }
    }
  }
/**
   * Runs the state machine at a fixed frequency.
   */
Runs the state machine at a fixed frequency.
Runs the state machine at a fixed frequency .
private void start() throws IOException {
    long now = 0;
    container.start();
    initCommandHandlerThread(conf);
    while (context.getState() != DatanodeStates.SHUTDOWN) {
      try {
        LOG.debug("Executing cycle Number : {}", context.getExecutionCount());
        nextHB.set(Time.monotonicNow() + heartbeatFrequency);
        context.setReportState(container.getNodeReport());
        context.setContainerReportState(container.getContainerReportState());
        context.execute(executorService, heartbeatFrequency,
            TimeUnit.MILLISECONDS);
        now = Time.monotonicNow();
        if (now < nextHB.get()) {
          Thread.sleep(nextHB.get() - now);
        }
      } catch (InterruptedException e) {
      } catch (Exception e) {
        LOG.error("Unable to finish the execution.", e);
      }
    }
  }
private void start ( ) throws IOException { long now = 0 ; container . start ( ) ; initCommandHandlerThread ( conf ) ; while ( context . getState ( ) != DatanodeStates . SHUTDOWN ) { try { LOG . debug ( "Executing cycle Number : {}" , context . getExecutionCount ( ) ) ; nextHB . set ( Time . monotonicNow ( ) + heartbeatFrequency ) ; context . setReportState ( container . getNodeReport ( ) ) ; context . setContainerReportState ( container . getContainerReportState ( ) ) ; context . execute ( executorService , heartbeatFrequency , TimeUnit . MILLISECONDS ) ; now = Time . monotonicNow ( ) ; if ( now < nextHB . get ( ) ) { Thread . sleep ( nextHB . get ( ) - now ) ; } } catch ( InterruptedException e ) { } catch ( Exception e ) { LOG . error ( "Unable to finish the execution." , e ) ; } } }
Runs the state machine at a fixed frequency.
Runs the state machine at a fixed frequency .
// Ignore this exception.