net.spy.memcached.MemcachedClient.addObserver()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中net.spy.memcached.MemcachedClient.addObserver()方法的一些代码示例,展示了MemcachedClient.addObserver()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MemcachedClient.addObserver()方法的具体详情如下:
包路径:net.spy.memcached.MemcachedClient
类名称:MemcachedClient
方法名:addObserver

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

  1. /**
  2. * Constructor.
  3. *
  4. * @param client The connection to Memcached
  5. * @param settings The configuration for the client
  6. */
  7. public GuavaMemcachedDataStore(MemcachedClient client, IMemcachedSettings settings) {
  8. this.client = Args.notNull(client, "client");
  9. this.settings = Args.notNull(settings, "settings");
  10. this.keysPerSession = CacheBuilder.newBuilder()
  11. .expireAfterAccess(settings.getExpirationTime(), TimeUnit.SECONDS)
  12. .build();
  13. client.addObserver(new ConnectionObserver()
  14. {
  15. @Override
  16. public void connectionEstablished(SocketAddress sa, int reconnectCount)
  17. {
  18. LOG.info("Established connection to: {}, reconnect count: {}", sa, reconnectCount);
  19. }
  20. @Override
  21. public void connectionLost(SocketAddress sa)
  22. {
  23. LOG.warn("Lost connection to: {}", sa);
  24. }
  25. });
  26. }

代码示例来源:origin: org.wicketstuff/wicketstuff-datastore-memcached

  1. /**
  2. * Constructor.
  3. *
  4. * @param client The connection to Memcached
  5. * @param settings The configuration for the client
  6. */
  7. public MemcachedDataStore(MemcachedClient client, IMemcachedSettings settings) {
  8. this.client = Args.notNull(client, "client");
  9. this.settings = Args.notNull(settings, "settings");
  10. client.addObserver(new ConnectionObserver()
  11. {
  12. @Override
  13. public void connectionEstablished(SocketAddress sa, int reconnectCount)
  14. {
  15. LOG.info("Established connection to: {}, reconnect count: {}", sa, reconnectCount);
  16. }
  17. @Override
  18. public void connectionLost(SocketAddress sa)
  19. {
  20. LOG.warn("Lost connection to: {}", sa);
  21. }
  22. });
  23. }

代码示例来源:origin: com.google.code.simple-spring-memcached/spymemcached

  1. authDescriptor = cf.getAuthDescriptor();
  2. if (authDescriptor != null) {
  3. addObserver(this);

代码示例来源:origin: com.amazonaws/elasticache-java-cluster-client

  1. executorService = cf.getListenerExecutorService();
  2. if (authDescriptor != null) {
  3. addObserver(this);

代码示例来源:origin: net.spy/spymemcached

  1. executorService = cf.getListenerExecutorService();
  2. if (authDescriptor != null) {
  3. addObserver(this);

代码示例来源:origin: com.google.code.maven-play-plugin.spy/spymemcached

  1. authDescriptor = cf.getAuthDescriptor();
  2. if(authDescriptor != null) {
  3. addObserver(this);

代码示例来源:origin: naver/arcus-java-client

  1. authDescriptor = cf.getAuthDescriptor();
  2. if (authDescriptor != null) {
  3. addObserver(this);

相关文章