Package me.ahoo.cosid.machine
Class DefaultMachineIdGuarder
java.lang.Object
me.ahoo.cosid.machine.DefaultMachineIdGuarder
- All Implemented Interfaces:
MachineIdGuarder
Default MachineId Guarder implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface me.ahoo.cosid.machine.MachineIdGuarder
MachineIdGuarder.None
-
Field Summary
Fields inherited from interface me.ahoo.cosid.machine.MachineIdGuarder
NONE
-
Constructor Summary
ConstructorDescriptionDefaultMachineIdGuarder
(MachineIdDistributor machineIdDistributor, Duration safeGuardDuration) DefaultMachineIdGuarder
(MachineIdDistributor machineIdDistributor, ScheduledExecutorService executorService, Duration initialDelay, Duration delay, Duration safeGuardDuration) -
Method Summary
Modifier and TypeMethodDescriptionstatic ScheduledExecutorService
boolean
void
register
(String namespace, InstanceId instanceId) void
start()
void
stop()
void
unregister
(String namespace, InstanceId instanceId)
-
Field Details
-
DEFAULT_INITIAL_DELAY
-
DEFAULT_DELAY
-
-
Constructor Details
-
DefaultMachineIdGuarder
public DefaultMachineIdGuarder(MachineIdDistributor machineIdDistributor, Duration safeGuardDuration) -
DefaultMachineIdGuarder
public DefaultMachineIdGuarder(MachineIdDistributor machineIdDistributor, ScheduledExecutorService executorService, Duration initialDelay, Duration delay, Duration safeGuardDuration)
-
-
Method Details
-
executorService
-
register
- Specified by:
register
in interfaceMachineIdGuarder
-
unregister
- Specified by:
unregister
in interfaceMachineIdGuarder
-
getRegisteredInstanceIds
-
start
public void start()- Specified by:
start
in interfaceMachineIdGuarder
-
stop
public void stop()- Specified by:
stop
in interfaceMachineIdGuarder
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceMachineIdGuarder
-