Search in sources :

Example 1 with ConcurrentArrayList

use of rpc.turbo.util.concurrent.ConcurrentArrayList in project turbo-rpc by hank-whu.

the class ZooKeeperDiscover method init.

@Override
public void init(List<HostPort> hostPorts) {
    watchers = new ConcurrentArrayList<>();
    String connectString = hostPorts.stream().map(i -> i.toString()).collect(Collectors.joining(","));
    RetryPolicy retryPolicy = new ForeverRetryPolicy(1000, 60 * 1000);
    client = CuratorFrameworkFactory.newClient(connectString, 1000 * 10, 1000 * 3, retryPolicy);
    client.start();
}
Also used : CuratorFrameworkFactory(org.apache.curator.framework.CuratorFrameworkFactory) Discover(rpc.turbo.discover.Discover) ConcurrentArrayList(rpc.turbo.util.concurrent.ConcurrentArrayList) IOException(java.io.IOException) Protocol(rpc.turbo.config.server.Protocol) Collectors(java.util.stream.Collectors) PathChildrenCacheListener(org.apache.curator.framework.recipes.cache.PathChildrenCacheListener) AddressWithWeight(rpc.turbo.config.AddressWithWeight) StartMode(org.apache.curator.framework.recipes.cache.PathChildrenCache.StartMode) ForeverRetryPolicy(rpc.turbo.zk.common.ForeverRetryPolicy) ConcurrentMap(java.util.concurrent.ConcurrentMap) Objects(java.util.Objects) List(java.util.List) CuratorFramework(org.apache.curator.framework.CuratorFramework) HostPort(rpc.turbo.config.HostPort) DiscoverListener(rpc.turbo.discover.DiscoverListener) RetryPolicy(org.apache.curator.RetryPolicy) PathChildrenCacheEvent(org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent) PathChildrenCache(org.apache.curator.framework.recipes.cache.PathChildrenCache) Log(org.apache.commons.logging.Log) LogFactory(org.apache.commons.logging.LogFactory) ConcurrentHashMap(org.jboss.netty.util.internal.ConcurrentHashMap) ForeverRetryPolicy(rpc.turbo.zk.common.ForeverRetryPolicy) ForeverRetryPolicy(rpc.turbo.zk.common.ForeverRetryPolicy) RetryPolicy(org.apache.curator.RetryPolicy)

Aggregations

IOException (java.io.IOException)1 List (java.util.List)1 Objects (java.util.Objects)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 Collectors (java.util.stream.Collectors)1 Log (org.apache.commons.logging.Log)1 LogFactory (org.apache.commons.logging.LogFactory)1 RetryPolicy (org.apache.curator.RetryPolicy)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1 CuratorFrameworkFactory (org.apache.curator.framework.CuratorFrameworkFactory)1 PathChildrenCache (org.apache.curator.framework.recipes.cache.PathChildrenCache)1 StartMode (org.apache.curator.framework.recipes.cache.PathChildrenCache.StartMode)1 PathChildrenCacheEvent (org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent)1 PathChildrenCacheListener (org.apache.curator.framework.recipes.cache.PathChildrenCacheListener)1 ConcurrentHashMap (org.jboss.netty.util.internal.ConcurrentHashMap)1 AddressWithWeight (rpc.turbo.config.AddressWithWeight)1 HostPort (rpc.turbo.config.HostPort)1 Protocol (rpc.turbo.config.server.Protocol)1 Discover (rpc.turbo.discover.Discover)1 DiscoverListener (rpc.turbo.discover.DiscoverListener)1