public class ClientStateListener extends Object implements LifecycleListener
Constructor and Description |
---|
ClientStateListener(ClientConfig clientConfig)
Registers this instance with the provided client configuration
|
Modifier and Type | Method and Description |
---|---|
boolean |
awaitConnected()
Waits until the client is connected to cluster.
|
boolean |
awaitConnected(long timeout,
TimeUnit unit)
Waits until the client is connected to cluster or the timeout expires.
|
boolean |
awaitDisconnected()
Waits until the client is disconnected from the cluster.
|
boolean |
awaitDisconnected(long timeout,
TimeUnit unit)
Waits until the client is disconnected from the cluster or the timeout expires.
|
LifecycleEvent.LifecycleState |
getCurrentState() |
boolean |
isConnected() |
boolean |
isShutdown() |
boolean |
isStarted() |
void |
stateChanged(LifecycleEvent event)
Called when instance's state changes.
|
public ClientStateListener(ClientConfig clientConfig)
clientConfig
- The client configuration to which this listener will be registeredpublic void stateChanged(LifecycleEvent event)
LifecycleListener
stateChanged
in interface LifecycleListener
event
- the Lifecycle eventpublic boolean awaitConnected(long timeout, TimeUnit unit) throws InterruptedException
timeout
- the maximum time to waitunit
- the time unit of the timeout
argumentisShutdown
getCurrentState
InterruptedException
public boolean awaitConnected() throws InterruptedException
awaitConnected(long timeout, TimeUnit unit)
returns.InterruptedException
public boolean awaitDisconnected(long timeout, TimeUnit unit) throws InterruptedException
timeout
- the maximum time to waitunit
- the time unit of the timeout
argumentisShutdown
getCurrentState
InterruptedException
public boolean awaitDisconnected() throws InterruptedException
awaitDisconnected(long timeout, TimeUnit unit)
returns.InterruptedException
public boolean isConnected()
public boolean isShutdown()
public boolean isStarted()
public LifecycleEvent.LifecycleState getCurrentState()
Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.