Class WorkerManager

  • All Implemented Interfaces:
    IWorkerManager

    public class WorkerManager
    extends java.lang.Object
    implements IWorkerManager
    WorkerManager class contains methods to manage workers
    • Field Detail

      • QUEUE_SIZE

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

      • WorkerManager

        public WorkerManager()
        Constructor
    • Method Detail

      • marshallToDB

        public void marshallToDB()
                          throws java.io.IOException
        Description copied from interface: IWorkerManager
        Marshall to Database
        Specified by:
        marshallToDB in interface IWorkerManager
        Throws:
        java.io.IOException
      • registerWorker

        public void registerWorker​(java.lang.String familyId,
                                   java.lang.String workerId,
                                   WorkerBean workerInformation)
                            throws ProcessingBadRequestException,
                                   java.io.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
        java.io.IOException
      • registerWorker

        public void registerWorker​(WorkerBean workerBean)
                            throws java.io.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:
        java.io.IOException - thrown when IOException occurs while read/save worker backup file
      • unregisterWorker

        public void unregisterWorker​(java.lang.String workerFamily,
                                     java.lang.String worker)
                              throws WorkerFamilyNotFoundException,
                                     java.io.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
        java.io.IOException - if IOException occurs
      • checkStatusWorker

        public boolean checkStatusWorker​(java.lang.String serverHost,
                                         int serverPort)
        Specified by:
        checkStatusWorker in interface IWorkerManager
      • findWorkerBy

        public WorkerFamilyManager findWorkerBy​(java.lang.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