Interface WorkerControl
public interface WorkerControl
Interface for controlling
Worker
lifecycle.-
Method Summary
Modifier and Type Method Description void
cleanupWorkers()
Cleanup any Workers that that were not properly cleaned up from Dispatcher restarts.default Worker
createWorker(String workerId, int clientConnectionPort, int websocketPort, String userName, RemoteProcessingRequest request, File clientClassDirectory, com.fishlib.io.logger.Logger log, ProcessEventLogFormat1Logger processEventLogLogger, String dispatcherHostName)
Delegate tocreateWorker(String, int, int, String, RemoteProcessingRequest, File, Logger, ProcessEventLogFormat1Logger, String, Consumer)
with a null workerTerminationCallback.Worker
createWorker(String workerId, int clientConnectionPort, int websocketPort, String userName, RemoteProcessingRequest request, File clientClassDirectory, com.fishlib.io.logger.Logger log, ProcessEventLogFormat1Logger processEventLogLogger, String dispatcherHostName, Consumer<Worker> workerTerminationCallback)
Construct a Worker with the specified request parameters needed to start the worker.void
startWorker(Worker worker)
Start theWorker
.void
terminateWorker(Worker worker)
Terminate theWorker
.
-
Method Details
-
createWorker
Worker createWorker(String workerId, int clientConnectionPort, int websocketPort, String userName, RemoteProcessingRequest request, File clientClassDirectory, com.fishlib.io.logger.Logger log, ProcessEventLogFormat1Logger processEventLogLogger, String dispatcherHostName, @NotNull Consumer<Worker> workerTerminationCallback)Construct a Worker with the specified request parameters needed to start the worker. Note: This create method should set up a data object only and not attempt to start or launch the Worker. Use the WorkerControl#startWorkerMethod() to start or launch the Workers- Parameters:
workerId
- A unique string representing the identifier for this WorkerclientConnectionPort
- The port to listen for client connectionswebsocketPort
- The port to listen for browser connectionsuserName
- The username of the requesterrequest
- TheRemoteProcessingRequest
specifying specifying the processing characteristicsclientClassDirectory
- The directory for client classeslog
- The logger to use for loggingprocessEventLogLogger
- The process event loggerdispatcherHostName
- The dispatcher hostnameworkerTerminationCallback
- A method to be called when a worker terminates- Returns:
- A
Worker
data object with attributes and settings of the of the Worker process
-
createWorker
@FinalDefault default Worker createWorker(String workerId, int clientConnectionPort, int websocketPort, String userName, RemoteProcessingRequest request, File clientClassDirectory, com.fishlib.io.logger.Logger log, ProcessEventLogFormat1Logger processEventLogLogger, String dispatcherHostName)Delegate tocreateWorker(String, int, int, String, RemoteProcessingRequest, File, Logger, ProcessEventLogFormat1Logger, String, Consumer)
with a null workerTerminationCallback.- Parameters:
workerId
- A unique string representing the identifier for this WorkerclientConnectionPort
- The port to listen for client connectionswebsocketPort
- The port to listen for browser connectionsuserName
- The username of the requesterrequest
- TheRemoteProcessingRequest
specifying specifying the processing characteristicsclientClassDirectory
- The directory for client classeslog
- The logger to use for loggingprocessEventLogLogger
- The process event loggerdispatcherHostName
- The dispatcher hostname- Returns:
- A
Worker
data object with attributes and settings of the of the Worker process
-
startWorker
Start theWorker
.- Parameters:
worker
- theWorker
to start.- Throws:
WorkerControlStartException
- If an error occurs starting the Worker
-
terminateWorker
Terminate theWorker
.- Parameters:
worker
- theWorker
to terminate.
-
cleanupWorkers
void cleanupWorkers()Cleanup any Workers that that were not properly cleaned up from Dispatcher restarts. This method should be called when WorkerControl is created.
-