本文整理了Java中net.spy.memcached.MemcachedClient.addObserver()
方法的一些代码示例,展示了MemcachedClient.addObserver()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MemcachedClient.addObserver()
方法的具体详情如下:
包路径:net.spy.memcached.MemcachedClient
类名称:MemcachedClient
方法名:addObserver
[英]Add a connection observer. If connections are already established, your observer will be called with the address and -1.
[中]添加一个连接观察者。如果已经建立了连接,您的观察者将被呼叫地址和-1。
代码示例来源:origin: org.wicketstuff/wicketstuff-datastore-memcached
/**
* Constructor.
*
* @param client The connection to Memcached
* @param settings The configuration for the client
*/
public GuavaMemcachedDataStore(MemcachedClient client, IMemcachedSettings settings) {
this.client = Args.notNull(client, "client");
this.settings = Args.notNull(settings, "settings");
this.keysPerSession = CacheBuilder.newBuilder()
.expireAfterAccess(settings.getExpirationTime(), TimeUnit.SECONDS)
.build();
client.addObserver(new ConnectionObserver()
{
@Override
public void connectionEstablished(SocketAddress sa, int reconnectCount)
{
LOG.info("Established connection to: {}, reconnect count: {}", sa, reconnectCount);
}
@Override
public void connectionLost(SocketAddress sa)
{
LOG.warn("Lost connection to: {}", sa);
}
});
}
代码示例来源:origin: org.wicketstuff/wicketstuff-datastore-memcached
/**
* Constructor.
*
* @param client The connection to Memcached
* @param settings The configuration for the client
*/
public MemcachedDataStore(MemcachedClient client, IMemcachedSettings settings) {
this.client = Args.notNull(client, "client");
this.settings = Args.notNull(settings, "settings");
client.addObserver(new ConnectionObserver()
{
@Override
public void connectionEstablished(SocketAddress sa, int reconnectCount)
{
LOG.info("Established connection to: {}, reconnect count: {}", sa, reconnectCount);
}
@Override
public void connectionLost(SocketAddress sa)
{
LOG.warn("Lost connection to: {}", sa);
}
});
}
代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached
authDescriptor = cf.getAuthDescriptor();
if (authDescriptor != null) {
addObserver(this);
代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client
executorService = cf.getListenerExecutorService();
if (authDescriptor != null) {
addObserver(this);
代码示例来源:origin: net.spy/spymemcached
executorService = cf.getListenerExecutorService();
if (authDescriptor != null) {
addObserver(this);
代码示例来源:origin: com.google.code.maven-play-plugin.spy/spymemcached
authDescriptor = cf.getAuthDescriptor();
if(authDescriptor != null) {
addObserver(this);
代码示例来源:origin: naver/arcus-java-client
authDescriptor = cf.getAuthDescriptor();
if (authDescriptor != null) {
addObserver(this);
内容来源于网络,如有侵权,请联系作者删除!