Class WorkerRegistryService


  • public class WorkerRegistryService
    extends Object
    Registry of task reactor workers.
    • Method Detail

      • getActiveWorkers

        public List<WorkerId> getActiveWorkers()
        Returns ids of active workers.
        Returns:
        list of ids of active workers
      • getActiveOrRequestedWorkersCount

        public int getActiveOrRequestedWorkersCount()
        Returns the number of active and requested workers.
        Returns:
        number of active and requested workers
      • getWorkersToProvision

        public List<WorkerId> getWorkersToProvision()
        Returns ids of requested workers.
        Returns:
        list of ids of requested workers
      • getActiveProvisioningOrUpForDeletionWorkers

        public List<WorkerId> getActiveProvisioningOrUpForDeletionWorkers()
        Returns ids of active, provisioning or up for deletion workers.
        Returns:
        list of ids of active, provisioning or up for deletion workers
      • getActiveOrUpForDeletionWorkers

        public List<WorkerId> getActiveOrUpForDeletionWorkers()
        Returns ids of active or up for deletion workers.
        Returns:
        list of ids of active or up for deletion workers
      • canProvisionWorker

        public boolean canProvisionWorker​(WorkerId workerId)
        Returns whether a worker with the specified id can be requested.
        Parameters:
        workerId - worker id
        Returns:
        whether a worker with the specified id can be requested
      • workerProvisioned

        public void workerProvisioned​(WorkerId workerId)
        Sets the status of the specified worker to ACTIVE.
        Parameters:
        workerId - worker id
      • getWorkersToDelete

        public List<WorkerId> getWorkersToDelete()
        Returns ids of workers waiting for deletion.
        Returns:
        list of ids of workers waiting for deletion
      • canDeleteWorker

        public boolean canDeleteWorker​(WorkerId workerId)
        Returns whether a worker with the specified id can be deleted.
        Parameters:
        workerId - worker id
        Returns:
        whether a worker with the specified id can be deleted
      • workerDeleted

        public void workerDeleted​(WorkerId workerId)
        Sets the status of the specified worker to DELETED.
        Parameters:
        workerId - worker id
      • addNewWorkers

        public void addNewWorkers​(int workersToAdd)
        Adds the specified numbers of workers to the instance.
        Parameters:
        workersToAdd - number of workers to add
      • deleteWorkers

        public void deleteWorkers​(int workersToDelete)
        Removes specified numbers of workers to the instance.
        Parameters:
        workersToDelete - number of workers to delete