Interface IWorkerManager

  • All Known Implementing Classes:
    WorkerManager

    public interface IWorkerManager
    Manage the parallelism calls to worker in the same distributor
    • Field Detail

      • WORKER_DB_PATH

        static final java.lang.String WORKER_DB_PATH
        Path to database
        See Also:
        Constant Field Values
    • Method Detail

      • initialize

        default void initialize()
                         throws java.io.IOException
        Do the initialization Load worker from worker.db
        Throws:
        java.io.IOException
      • loadWorkerList

        default void loadWorkerList​(java.io.File registerWorkerFile)
                             throws java.io.IOException
        To load a registered worker list
        Parameters:
        registerWorkerFile - the register worker file
        Throws:
        java.io.IOException
      • checkStatusWorker

        boolean checkStatusWorker​(java.lang.String serverHost,
                                  int serverPort)
      • registerWorker

        void registerWorker​(java.lang.String familyId,
                            java.lang.String workerId,
                            WorkerBean workerInformation)
                     throws ProcessingBadRequestException,
                            java.io.IOException
        To register a worker in the processing
        Parameters:
        familyId - : family of this worker
        workerId - : ID of the worker
        workerInformation - : Worker Json representation
        Throws:
        ProcessingBadRequestException - if cannot register worker to family
        InvalidParseOperationException - if worker description is not well-formed
        java.io.IOException
      • registerWorker

        void registerWorker​(WorkerBean workerBean)
                     throws java.io.IOException
        Register a worker
        Parameters:
        workerBean - the worker description as a WorkerBean object
        Throws:
        java.io.IOException - thrown when IOException occurs while read/save worker backup file
      • unregisterWorker

        void unregisterWorker​(java.lang.String familyId,
                              java.lang.String workerId)
                       throws WorkerFamilyNotFoundException,
                              java.io.IOException
        To unregister a worker in the processing
        Parameters:
        familyId - : family of this worker
        workerId - : ID of the worker
        Throws:
        WorkerFamilyNotFoundException - : when the family is unknown
        java.io.IOException - if IOException occurs
      • marshallToDB

        void marshallToDB()
                   throws java.io.IOException
        Marshall to Database
        Throws:
        java.io.IOException
      • findWorkerBy

        WorkerFamilyManager findWorkerBy​(java.lang.String workerFamily)
        Find a worker by its family
        Parameters:
        workerFamily - the worker family
        Returns:
        a WorkerFamilyManager object
      • getWorkerDbFile

        java.io.File getWorkerDbFile()