Package io.openems.common.websocket
Class ClientReconnectorWorker
- java.lang.Object
-
- io.openems.common.worker.AbstractWorker
-
- io.openems.common.websocket.ClientReconnectorWorker
-
public class ClientReconnectorWorker extends AbstractWorker
-
-
Field Summary
-
Fields inherited from class io.openems.common.worker.AbstractWorker
ALWAYS_WAIT_FOR_TRIGGER_NEXT_RUN, DO_NOT_WAIT, thread
-
-
Constructor Summary
Constructors Constructor Description ClientReconnectorWorker(AbstractWebsocketClient<?> parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
forever()
This method is called in a loop forever until the Thread gets interrupted.protected int
getCycleTime()
Gets the cycleTime of this worker in [ms].protected static void
resetWebSocketClient(org.java_websocket.client.WebSocketClient ws)
This method is a copy ofWebSocketClient
reset()-method, because the original one may block at the call of 'closeBlocking()' method.-
Methods inherited from class io.openems.common.worker.AbstractWorker
activate, deactivate, modified, triggerNextRun
-
-
-
-
Constructor Detail
-
ClientReconnectorWorker
public ClientReconnectorWorker(AbstractWebsocketClient<?> parent)
-
-
Method Detail
-
forever
protected void forever() throws java.lang.Exception
Description copied from class:AbstractWorker
This method is called in a loop forever until the Thread gets interrupted.- Specified by:
forever
in classAbstractWorker
- Throws:
java.lang.Exception
-
resetWebSocketClient
protected static void resetWebSocketClient(org.java_websocket.client.WebSocketClient ws) throws java.lang.Exception
This method is a copy ofWebSocketClient
reset()-method, because the original one may block at the call of 'closeBlocking()' method.Waiting for https://github.com/TooTallNate/Java-WebSocket/pull/1251 to be merged.
- Parameters:
ws
- theWebSocketClient
- Throws:
java.lang.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 classAbstractWorker
- Returns:
- the cycleTime
-
-