Package com.bytedesk.core.uid.worker
Class DisposableWorkerIdAssigner
java.lang.Object
com.bytedesk.core.uid.worker.DisposableWorkerIdAssigner
- All Implemented Interfaces:
WorkerIdAssigner
Represents an implementation of
WorkerIdAssigner
,
the worker id will be discarded after assigned to the UidGenerator- Author:
- yutianbao
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Assign fake worker idlong
Assign worker id base on database.<p> If there is host name and port in the environment, we considered that the node runs in Docker container<br> Otherwise, the node runs on an actual machine.private UidGeneratorEntity
private UidGeneratorEntity
Build worker node entity by IP and PORT
-
Field Details
-
port
-
workerNodeDAO
-
-
Constructor Details
-
DisposableWorkerIdAssigner
public DisposableWorkerIdAssigner()
-
-
Method Details
-
assignWorkerId
Assign worker id base on database.<p> If there is host name and port in the environment, we considered that the node runs in Docker container<br> Otherwise, the node runs on an actual machine.- Specified by:
assignWorkerId
in interfaceWorkerIdAssigner
- Returns:
- assigned worker id
-
assignFakeWorkerId
Description copied from interface:WorkerIdAssigner
Assign fake worker id- Specified by:
assignFakeWorkerId
in interfaceWorkerIdAssigner
- Returns:
- assigned fake worker id
-
buildWorkerNode
Build worker node entity by IP and PORT -
buildFakeWorkerNode
-