Class ClientReconnectorWorker

java.lang.Object
io.openems.common.worker.AbstractWorker
io.openems.common.websocket.ClientReconnectorWorker

public class ClientReconnectorWorker extends AbstractWorker
  • Constructor Details

  • Method Details

    • forever

      protected void forever() throws Exception
      Description copied from class: AbstractWorker
      This method is called in a loop forever until the Thread gets interrupted.
      Specified by:
      forever in class AbstractWorker
      Throws:
      Exception
    • resetWebSocketClient

      protected static <T extends WsData> void resetWebSocketClient(org.java_websocket.client.WebSocketClient ws, Supplier<T> attachmentSupplier) throws Exception
      This method is a copy of WebSocketClient reset()-method, because the original one may block at the call of 'closeBlocking()' method. It also sets the new attachment from the attachment supplier.

      Waiting for https://github.com/TooTallNate/Java-WebSocket/pull/1251 to be merged.

      Type Parameters:
      T - the type of the attachment
      Parameters:
      ws - the WebSocketClient
      attachmentSupplier - the supplier for the new attachment
      Throws:
      Exception - on error
    • getCycleTime

      protected int getCycleTime()
      Description copied from class: AbstractWorker
      Gets the cycleTime of this worker in [ms].
      • > 0 sets the minimum execution time of one Cycle
      • = 0 never wait between two consecutive executions of forever()
      • < 0 causes the Cycle to sleep forever until 'triggerNextRun()' is called
      Specified by:
      getCycleTime in class AbstractWorker
      Returns:
      the cycleTime