src/main/java/com/hedera/hashgraph/identity/hcs/MessageResolver.java
/**
   * Waits for a new message from the topic for the configured amount of time.
   */
Waits for a new message from the topic for the configured amount of time.
Waits for a new message from the topic for the configured amount of time .
private void waitOrFinish() {
    long timeDiff = System.currentTimeMillis() - lastMessageArrivalTime.get();
    if (timeDiff < noMoreMessagesTimeout) {
      Runnable finishTask = () -> waitOrFinish();
      executorService.schedule(finishTask, noMoreMessagesTimeout - timeDiff, TimeUnit.MILLISECONDS);
      return;
    }
    resultsHandler.accept(results);
    if (listener != null) {
      listener.unsubscribe();
    }
    if (executorService != null) {
      executorService.shutdown();
    }
  }
private void waitOrFinish ( ) { long timeDiff = System . currentTimeMillis ( ) - lastMessageArrivalTime . get ( ) ; if ( timeDiff < noMoreMessagesTimeout ) { Runnable finishTask = ( ) -> waitOrFinish ( ) ; executorService . schedule ( finishTask , noMoreMessagesTimeout - timeDiff , TimeUnit . MILLISECONDS ) ; return ; } resultsHandler . accept ( results ) ; if ( listener != null ) { listener . unsubscribe ( ) ; } if ( executorService != null ) { executorService . shutdown ( ) ; } }
Waits for a new message from the topic for the configured amount of time.
Waits for a new message from the topic for the configured amount of time .
// Check if the task should be rescheduled as new message arrived. // Finish the task // Stop listening for new messages. // Stop the timeout executor.