Package fr.gouv.vitam.processing.distributor.core

# Class WorkerManager

java.lang.Object
fr.gouv.vitam.processing.distributor.core.WorkerManager

All Implemented Interfaces:
  `IWorkerManager`

public class WorkerManager extends Object implements IWorkerManager
WorkerManager class contains methods to manage workers

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `QUEUE_SIZE`
  Default queue size FIXME : why 15 ? Why not configurable

  ### Fields inherited from interface fr.gouv.vitam.processing.distributor.api.IWorkerManager

  `WORKER_DB_PATH`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WorkerManager()`
  Constructor
  `WorkerManager(WorkerClientFactory workerClientFactory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `checkStatusWorker(String serverHost, int serverPort)`
  `WorkerFamilyManager`
  `findWorkerBy(String workerFamily)`
  Find a worker by its family
  `File`
  `getWorkerDbFile()`
  `void`
  `marshallToDB()`
  Marshall to Database
  `void`
  `registerWorker(WorkerBean workerBean)`
  Register a worker
  `void`
  `registerWorker(String familyId, String workerId, WorkerBean workerInformation)`
  To register a worker in the processing
  `void`
  `unregisterWorker(String workerFamily, String worker)`
  To unregister a worker in the processing

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface fr.gouv.vitam.processing.distributor.api.IWorkerManager

  `initialize, loadWorkerList`

- ## Field Details

  - ### QUEUE_SIZE

    public static final int QUEUE_SIZE
    Default queue size FIXME : why 15 ? Why not configurable
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### WorkerManager

    public WorkerManager()
    Constructor

  - ### WorkerManager

    public WorkerManager(WorkerClientFactory workerClientFactory)

- ## Method Details

  - ### marshallToDB

    public void marshallToDB() throws IOException
    Description copied from interface: `IWorkerManager`
    Marshall to Database
    Specified by:
      `marshallToDB` in interface `IWorkerManager`
    Throws:
      `IOException`

  - ### registerWorker

    public void registerWorker(String familyId, String workerId, WorkerBean workerInformation) throws ProcessingBadRequestException, IOException
    Description copied from interface: `IWorkerManager`
    To register a worker in the processing
    Specified by:
      `registerWorker` in interface `IWorkerManager`
    Parameters:
      `familyId` - : family of this worker
      `workerId` - : ID of the worker
      `workerInformation` - : Worker Json representation
    Throws:
      `ProcessingBadRequestException` - if cannot register worker to family
      `IOException`

  - ### registerWorker

    public void registerWorker(WorkerBean workerBean) throws IOException
    Description copied from interface: `IWorkerManager`
    Register a worker
    Specified by:
      `registerWorker` in interface `IWorkerManager`
    Parameters:
      `workerBean` - the worker description as a WorkerBean object
    Throws:
      `IOException` - thrown when IOException occurs while read/save worker backup file

  - ### unregisterWorker

    public void unregisterWorker(String workerFamily, String worker) throws WorkerFamilyNotFoundException, IOException
    Description copied from interface: `IWorkerManager`
    To unregister a worker in the processing
    Specified by:
      `unregisterWorker` in interface `IWorkerManager`
    Parameters:
      `workerFamily` - : family of this worker
      `worker` - : ID of the worker
    Throws:
      `WorkerFamilyNotFoundException` - : when the family is unknown
      `IOException` - if IOException occurs

  - ### checkStatusWorker

    public boolean checkStatusWorker(String serverHost, int serverPort)
    Specified by:
      `checkStatusWorker` in interface `IWorkerManager`

  - ### findWorkerBy

    public WorkerFamilyManager findWorkerBy(String workerFamily)
    Description copied from interface: `IWorkerManager`
    Find a worker by its family
    Specified by:
      `findWorkerBy` in interface `IWorkerManager`
    Parameters:
      `workerFamily` - the worker family
    Returns:
      a WorkerFamilyManager object

  - ### getWorkerDbFile

    public File getWorkerDbFile()
    Specified by:
      `getWorkerDbFile` in interface `IWorkerManager`