com.couchbase.client.vbucket
Class BucketMonitor

java.lang.Object
  extended by java.util.Observable
      extended by com.couchbase.client.vbucket.BucketMonitor

public class BucketMonitor
extends java.util.Observable

The BucketMonitor will open an HTTP comet stream to monitor for changes to the list of nodes. If the list of nodes changes, it will notify observers.


Field Summary
static java.lang.String CLIENT_SPEC_VER
          The specification version which this client meets.
 
Constructor Summary
BucketMonitor(java.net.URI cometStreamURI, java.lang.String bucketname, java.lang.String username, java.lang.String password, ConfigurationParser configParser)
           
 
Method Summary
protected  void createChannel()
           
 java.lang.String getHttpPass()
           
 java.lang.String getHttpUser()
           
protected  void notifyDisconnected()
          Take any action required when the monitor appears to be disconnected.
protected  org.jboss.netty.handler.codec.http.HttpRequest prepareRequest(java.net.URI uri, java.lang.String h)
           
protected  void replaceConfig()
          Replace the previously received configuration with the current one.
 void setConfigParser(ConfigurationParser newConfigParser)
           
 void shutdown()
          Shut down the monitor in a graceful way (and release all resources).
 void shutdown(long timeout, java.util.concurrent.TimeUnit unit)
          Shut down this monitor in a graceful way.
 void startMonitor()
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT_SPEC_VER

public static final java.lang.String CLIENT_SPEC_VER
The specification version which this client meets. This will be included in requests to the server.

See Also:
Constant Field Values
Constructor Detail

BucketMonitor

public BucketMonitor(java.net.URI cometStreamURI,
                     java.lang.String bucketname,
                     java.lang.String username,
                     java.lang.String password,
                     ConfigurationParser configParser)
Parameters:
cometStreamURI - the URI which will stream node changes
bucketname - the bucketToMonitor name we are monitoring
username - the username required for HTTP Basic Auth to the restful service
password - the password required for HTTP Basic Auth to the restful service
Method Detail

notifyDisconnected

protected void notifyDisconnected()
Take any action required when the monitor appears to be disconnected.


startMonitor

public void startMonitor()

createChannel

protected void createChannel()

prepareRequest

protected org.jboss.netty.handler.codec.http.HttpRequest prepareRequest(java.net.URI uri,
                                                                        java.lang.String h)

getHttpUser

public java.lang.String getHttpUser()
Returns:
the httpUser

getHttpPass

public java.lang.String getHttpPass()
Returns:
the httpPass

shutdown

public void shutdown()
Shut down the monitor in a graceful way (and release all resources).


shutdown

public void shutdown(long timeout,
                     java.util.concurrent.TimeUnit unit)
Shut down this monitor in a graceful way.

Parameters:
timeout -
unit -

replaceConfig

protected void replaceConfig()
Replace the previously received configuration with the current one.


setConfigParser

public void setConfigParser(ConfigurationParser newConfigParser)


Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.