Interface WorkerControl


public interface WorkerControl
Interface for controlling Worker lifecycle.
  • 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 Worker
      clientConnectionPort - The port to listen for client connections
      websocketPort - The port to listen for browser connections
      userName - The username of the requester
      request - The RemoteProcessingRequest specifying specifying the processing characteristics
      clientClassDirectory - The directory for client classes
      log - The logger to use for logging
      processEventLogLogger - The process event logger
      dispatcherHostName - The dispatcher hostname
      workerTerminationCallback - 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)
      Parameters:
      workerId - A unique string representing the identifier for this Worker
      clientConnectionPort - The port to listen for client connections
      websocketPort - The port to listen for browser connections
      userName - The username of the requester
      request - The RemoteProcessingRequest specifying specifying the processing characteristics
      clientClassDirectory - The directory for client classes
      log - The logger to use for logging
      processEventLogLogger - The process event logger
      dispatcherHostName - The dispatcher hostname
      Returns:
      A Worker data object with attributes and settings of the of the Worker process
    • startWorker

      void startWorker​(@NotNull Worker worker) throws WorkerControlStartException
      Start the Worker.
      Parameters:
      worker - the Worker to start.
      Throws:
      WorkerControlStartException - If an error occurs starting the Worker
    • terminateWorker

      void terminateWorker​(@NotNull Worker worker)
      Terminate the Worker.
      Parameters:
      worker - the Worker 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.