net.spy.memcached.ConfigurationPoller Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of memcached-client Show documentation
Show all versions of memcached-client Show documentation
Memcached Client is an enhanced Java library to connect to Memcached clusters. This client library has been built upon Spymemcached and is released under the Apache 2.0 License.
The newest version!
/**
* Copyright (C) 2012-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
package net.spy.memcached;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import net.spy.memcached.compat.SpyThread;
import net.spy.memcached.config.ClusterConfiguration;
import net.spy.memcached.config.ClusterConfigurationObserver;
import net.spy.memcached.config.NodeEndPoint;
import net.spy.memcached.ops.ConfigurationType;
import net.spy.memcached.transcoders.SerializingTranscoder;
import net.spy.memcached.transcoders.Transcoder;
/**
* A periodic poller to fetch configuration information from the server. This also acts as
* the publisher when there is change in the configuration.
*
*/
public class ConfigurationPoller extends SpyThread{
//5 second initial delay before starting poller.
private static final long INITIAL_DELAY = 5000l;
// 1 minute polling interval
public static final long DEFAULT_POLL_INTERVAL = 60000l;
private static final int MAX_RETRY_ATTEMPT = 3;
//500 ms interval between retries;
private static final long RETRY_INTERVAL = 500l;
private final MemcachedClient client;
private List clusterConfigObservers = new ArrayList();
private String currentClusterConfigResponse;
private ClusterConfiguration currentClusterConfiguration;
//The transcoder used for config.
private Transcoder
© 2015 - 2025 Weber Informatics LLC | Privacy Policy