@Named public final class HazelcastDiscoveryService extends java.lang.Object implements org.springframework.context.SmartLifecycle, DiscoveryService
Modifier and Type | Class and Description |
---|---|
private static class |
HazelcastDiscoveryService.MapUpdateCallback |
private class |
HazelcastDiscoveryService.NeighbourMapListener |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
entryListenerId |
private EventBus |
eventBus |
private ListeningScheduledExecutorService |
executorService |
private HazelcastInstance |
hazelcastInstance |
private NodeIdentityService |
identityService |
private static org.slf4j.Logger |
logger |
private IMap<java.lang.String,NodeDescriptor> |
members |
private java.lang.String |
nodeId |
private java.util.concurrent.atomic.AtomicBoolean |
running |
private static @s long |
UPDATE_PERIOD_IN_S |
Constructor and Description |
---|
HazelcastDiscoveryService(HazelcastInstance hazelcastInstance,
EventBus eventBus,
NodeIdentityService identityService) |
Modifier and Type | Method and Description |
---|---|
java.util.Set<NodeDescriptor> |
allMembers()
Returns
NodeDescriptor s of all cluster members. |
private void |
cleanUp() |
int |
getPhase() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
java.util.Set<NodeDescriptor> |
membersMatching(java.lang.String criteria)
Returns
NodeDescriptor s of cluster members matching the given criteria. |
java.util.Optional<NodeDescriptor> |
memberWithId(java.lang.String id)
Returns
NodeDescriptor for the node with the given ID. |
private void |
onHazelcastStateChange(LifecycleEvent event) |
void |
start() |
void |
stop() |
void |
stop(java.lang.Runnable callback) |
private void |
updateMap() |
private static final @s long UPDATE_PERIOD_IN_S
private static final org.slf4j.Logger logger
private final ListeningScheduledExecutorService executorService
private final java.util.concurrent.atomic.AtomicBoolean running
private final HazelcastInstance hazelcastInstance
private final NodeIdentityService identityService
private final EventBus eventBus
private final IMap<java.lang.String,NodeDescriptor> members
private final java.lang.String nodeId
private final java.lang.String entryListenerId
@Inject public HazelcastDiscoveryService(HazelcastInstance hazelcastInstance, EventBus eventBus, NodeIdentityService identityService)
public boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public void stop(java.lang.Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
public void start()
start
in interface org.springframework.context.Lifecycle
public void stop()
stop
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
public int getPhase()
getPhase
in interface org.springframework.context.Phased
public java.util.Set<NodeDescriptor> membersMatching(java.lang.String criteria)
DiscoveryService
Returns NodeDescriptor
s of cluster members matching the given criteria.
membersMatching
in interface DiscoveryService
criteria
- Criteria in the form of SQL query.SqlPredicate
public java.util.Set<NodeDescriptor> allMembers()
DiscoveryService
Returns NodeDescriptor
s of all cluster members.
allMembers
in interface DiscoveryService
public java.util.Optional<NodeDescriptor> memberWithId(java.lang.String id)
DiscoveryService
Returns NodeDescriptor
for the node with the given ID.
memberWithId
in interface DiscoveryService
id
- an ID to look up.private void updateMap()
private void cleanUp()
private void onHazelcastStateChange(LifecycleEvent event)