java.io.Closeable, java.lang.AutoCloseablepublic class ConnectionStateManager
extends java.lang.Object
implements java.io.Closeable
| Constructor | Description |
|---|---|
ConnectionStateManager(CuratorFramework client,
java.util.concurrent.ThreadFactory threadFactory,
int sessionTimeoutMs,
int sessionExpirationPercent) |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
addStateChange(ConnectionState newConnectionState) |
Post a state change.
|
boolean |
blockUntilConnected(int maxWaitTime,
java.util.concurrent.TimeUnit units) |
|
void |
close() |
|
ListenerContainer<ConnectionStateListener> |
getListenable() |
Return the listenable
|
boolean |
isConnected() |
|
boolean |
setToSuspended() |
Change to
ConnectionState.SUSPENDED only if not already suspended and not lost |
void |
start() |
Start the manager
|
public ConnectionStateManager(CuratorFramework client, java.util.concurrent.ThreadFactory threadFactory, int sessionTimeoutMs, int sessionExpirationPercent)
client - the clientthreadFactory - thread factory to use or null for a defaultsessionTimeoutMs - the ZK session timeout in millisecondssessionExpirationPercent - percentage of negotiated session timeout to use when simulating a session timeout. 0 means don't simulate at allpublic void start()
public void close()
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablepublic ListenerContainer<ConnectionStateListener> getListenable()
public boolean setToSuspended()
ConnectionState.SUSPENDED only if not already suspended and not lostpublic boolean addStateChange(ConnectionState newConnectionState)
newConnectionState - new statepublic boolean blockUntilConnected(int maxWaitTime,
java.util.concurrent.TimeUnit units)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic boolean isConnected()
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.