org.apache.curator.framework.state
Class ConnectionStateManager

java.lang.Object
  extended by org.apache.curator.framework.state.ConnectionStateManager
All Implemented Interfaces:
Closeable

public class ConnectionStateManager
extends Object
implements Closeable

Used internally to manage connection state


Constructor Summary
ConnectionStateManager(CuratorFramework client, ThreadFactory threadFactory)
           
 
Method Summary
 boolean addStateChange(ConnectionState newConnectionState)
          Post a state change.
 boolean blockUntilConnected(int maxWaitTime, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionStateManager

public ConnectionStateManager(CuratorFramework client,
                              ThreadFactory threadFactory)
Parameters:
client - the client
threadFactory - thread factory to use or null for a default
Method Detail

start

public void start()
Start the manager


close

public void close()
Specified by:
close in interface Closeable

getListenable

public ListenerContainer<ConnectionStateListener> getListenable()
Return the listenable

Returns:
listenable

setToSuspended

public boolean setToSuspended()
Change to ConnectionState.SUSPENDED only if not already suspended and not lost

Returns:
true if connection is set to SUSPENDED

addStateChange

public boolean addStateChange(ConnectionState newConnectionState)
Post a state change. If the manager is already in that state the change is ignored. Otherwise the change is queued for listeners.

Parameters:
newConnectionState - new state
Returns:
true if the state actually changed, false if it was already at that state

blockUntilConnected

public boolean blockUntilConnected(int maxWaitTime,
                                   TimeUnit units)
                            throws InterruptedException
Throws:
InterruptedException

isConnected

public boolean isConnected()


Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.