Class WorkerManager
- java.lang.Object
-
- fr.gouv.vitam.processing.distributor.core.WorkerManager
-
- All Implemented Interfaces:
IWorkerManager
public class WorkerManager extends java.lang.Object implements IWorkerManager
WorkerManager class contains methods to manage workers
-
-
Field Summary
Fields Modifier and Type Field Description static 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()
ConstructorWorkerManager(WorkerClientFactory workerClientFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkStatusWorker(java.lang.String serverHost, int serverPort)
WorkerFamilyManager
findWorkerBy(java.lang.String workerFamily)
Find a worker by its familyjava.io.File
getWorkerDbFile()
void
marshallToDB()
Marshall to Databasevoid
registerWorker(WorkerBean workerBean)
Register a workervoid
registerWorker(java.lang.String familyId, java.lang.String workerId, WorkerBean workerInformation)
To register a worker in the processingvoid
unregisterWorker(java.lang.String workerFamily, java.lang.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 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
-
WorkerManager
public WorkerManager(WorkerClientFactory workerClientFactory)
-
-
Method Detail
-
marshallToDB
public void marshallToDB() throws java.io.IOException
Description copied from interface:IWorkerManager
Marshall to Database- Specified by:
marshallToDB
in interfaceIWorkerManager
- 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 interfaceIWorkerManager
- Parameters:
familyId
- : family of this workerworkerId
- : ID of the workerworkerInformation
- : Worker Json representation- Throws:
ProcessingBadRequestException
- if cannot register worker to familyjava.io.IOException
-
registerWorker
public void registerWorker(WorkerBean workerBean) throws java.io.IOException
Description copied from interface:IWorkerManager
Register a worker- Specified by:
registerWorker
in interfaceIWorkerManager
- 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 interfaceIWorkerManager
- Parameters:
workerFamily
- : family of this workerworker
- : ID of the worker- Throws:
WorkerFamilyNotFoundException
- : when the family is unknownjava.io.IOException
- if IOException occurs
-
checkStatusWorker
public boolean checkStatusWorker(java.lang.String serverHost, int serverPort)
- Specified by:
checkStatusWorker
in interfaceIWorkerManager
-
findWorkerBy
public WorkerFamilyManager findWorkerBy(java.lang.String workerFamily)
Description copied from interface:IWorkerManager
Find a worker by its family- Specified by:
findWorkerBy
in interfaceIWorkerManager
- Parameters:
workerFamily
- the worker family- Returns:
- a WorkerFamilyManager object
-
getWorkerDbFile
public java.io.File getWorkerDbFile()
- Specified by:
getWorkerDbFile
in interfaceIWorkerManager
-
-