Class IDEHeartbeatScheduler

java.lang.Object
com.vaadin.copilot.ide.IDEHeartbeatScheduler

public class IDEHeartbeatScheduler extends Object
A scheduler implementation that sends a request to IDE plugin in an interval and shares the response with consumers.

Scheduler won't be created in the following conditions:

  • Method Details

    • getInstance

      public static IDEHeartbeatScheduler getInstance()
      Gets the singleton instance of IDEHeartbeatScheduler.

      This method is synchronized to ensure thread-safety

      Returns:
      the instance
    • startIfNotStarted

      public void startIfNotStarted()
      Starts scheduler if not started. This method considers state of IDE Plugin activation, also works only if IDE Plugin supports HEARTBEAT command. Once it is started, an internal flag is set so it cannot be started again. This method is synchronized to ensure thread-safety
    • addConsumer

      public void addConsumer(Consumer<IDEHeartbeatResponse> consumer)
      Saves the consumer into a set so that gets heartbeat responses from the IDE