本文整理汇总了Java中net.spy.memcached.ConnectionObserver类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionObserver类的具体用法?Java ConnectionObserver怎么用?Java ConnectionObserver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionObserver类属于net.spy.memcached包,在下文中一共展示了ConnectionObserver类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getObject
import net.spy.memcached.ConnectionObserver; //导入依赖的package包/类
@Override
public Object getObject() throws IOException {
List<URI> addresses = getAddresses(connectionURI);
long timeout = Math.max(readTimeout, writeTimeout);
//TODO make all the below properties configurable via properties file
ConnectionFactoryBuilder builder = new CouchbaseConnectionFactoryBuilder()
.setOpTimeout(timeout) // wait up to timeout seconds for an operation to succeed
.setOpQueueMaxBlockTime(enqueueTimeout) // wait up to 'enqueueTimeout' seconds when trying to enqueue an operation
.setDaemon(true)
.setProtocol(Protocol.BINARY)
.setHashAlg(DefaultHashAlgorithm.KETAMA_HASH)
.setFailureMode(FailureMode.Redistribute)
.setInitialObservers(Collections.singleton((ConnectionObserver) new CouchbaseAlerter()));
if(transcoder!=null) {
builder.setTranscoder(transcoder);
}
//assuming there isn't any password set for Couchbase
CouchbaseConnectionFactory connectionFactory
= ((CouchbaseConnectionFactoryBuilder)builder).buildCouchbaseConnection(addresses, "default", "", "");
return new CouchbaseClient(connectionFactory);
}
示例2: setInitialObservers
import net.spy.memcached.ConnectionObserver; //导入依赖的package包/类
public void setInitialObservers(final Collection<ConnectionObserver> obs) {
connectionFactoryBuilder.setInitialObservers(obs);
}
示例3: addObserver
import net.spy.memcached.ConnectionObserver; //导入依赖的package包/类
@Override
public boolean addObserver(ConnectionObserver obs) {
return false;
}
示例4: removeObserver
import net.spy.memcached.ConnectionObserver; //导入依赖的package包/类
@Override
public boolean removeObserver(ConnectionObserver obs) {
return false;
}
示例5: getInitialObservers
import net.spy.memcached.ConnectionObserver; //导入依赖的package包/类
public Collection<ConnectionObserver> getInitialObservers() {
return super.getInitialObservers();
}
示例6: addObserver
import net.spy.memcached.ConnectionObserver; //导入依赖的package包/类
/**
* TODO 添加方法注释.
*
* @param obs obs
*/
public void addObserver(ConnectionObserver obs) {
memcachedClient.addObserver(obs);
}
示例7: removeObserver
import net.spy.memcached.ConnectionObserver; //导入依赖的package包/类
/**
* TODO 添加方法注释.
*
* @param obs obs
*/
public void removeObserver(ConnectionObserver obs) {
memcachedClient.removeObserver(obs);
}