public PathChildrenCache make(CuratorFramework curator, String path) { return new PathChildrenCache( curator, path, cacheData, compressed, new CloseableExecutorService(exec, shutdownExecutorOnClose) ); }
/** * Optional executor getGroup to use for the cache's background thread * * @param executorService executor getGroup * @return this */ @Override public ServiceCacheBuilder<T> executorService(ExecutorService executorService) { this.executorService = new CloseableExecutorService(executorService); this.threadFactory = null; return this; }
/** * @param client the client * @param path path to watch * @param cacheData if true, node contents are cached in addition to the stat * @param dataIsCompressed if true, data in the path is compressed * @param executorService ExecutorService to use for the PathChildrenCache's background thread. This getGroup should be single threaded, otherwise the cache may see inconsistent results. */ public PathChildrenCache(CuratorFramework client, String path, boolean cacheData, boolean dataIsCompressed, final ExecutorService executorService) { this(client, path, cacheData, dataIsCompressed, new CloseableExecutorService(executorService)); }
/** * @param client the client * @param leaderPath the path for this leadership group * @param executorService thread pool to use * @param listener listener */ public LeaderSelector(CuratorFramework client, String leaderPath, ExecutorService executorService, LeaderSelectorListener listener) { this(client, leaderPath, new CloseableExecutorService(executorService), listener); }
/** * Optional executor service to use for the cache's background thread * * @param executorService executor service * @return this */ @Override public ServiceCacheBuilder<T> executorService(ExecutorService executorService) { this.executorService = new CloseableExecutorService(executorService); this.threadFactory = null; return this; }
/** * @param client the client * @param path path to watch * @param cacheData if true, node contents are cached in addition to the stat * @param dataIsCompressed if true, data in the path is compressed * @param threadFactory factory to use when creating internal threads */ public PathChildrenCache(CuratorFramework client, String path, boolean cacheData, boolean dataIsCompressed, ThreadFactory threadFactory) { this(client, path, cacheData, dataIsCompressed, new CloseableExecutorService(Executors.newSingleThreadExecutor(threadFactory), true)); }
/** * @param client the client * @param leaderPath the path for this leadership group * @param listener listener */ public LeaderSelector(CuratorFramework client, String leaderPath, LeaderSelectorListener listener) { this(client, leaderPath, new CloseableExecutorService(Executors.newSingleThreadExecutor(defaultThreadFactory), true), listener); }
/** * @param client the client * @param path path to watch * @param cacheData if true, node contents are cached in addition to the stat */ public PathChildrenCache(CuratorFramework client, String path, boolean cacheData) { this(client, path, cacheData, false, new CloseableExecutorService(Executors.newSingleThreadExecutor(defaultThreadFactory), true)); }
/** * @param client the client * @param path path to watch * @param cacheData if true, node contents are cached in addition to the stat * @param threadFactory factory to use when creating internal threads */ public PathChildrenCache(CuratorFramework client, String path, boolean cacheData, ThreadFactory threadFactory) { this(client, path, cacheData, false, new CloseableExecutorService(Executors.newSingleThreadExecutor(threadFactory), true)); }
/** * @param client the client * @param path path to watch * @param mode caching mode * @deprecated use {@link #PathChildrenCache(CuratorFramework, String, boolean)} instead */ @Deprecated @SuppressWarnings("deprecation") public PathChildrenCache(CuratorFramework client, String path, PathChildrenCacheMode mode) { this(client, path, mode != PathChildrenCacheMode.CACHE_PATHS_ONLY, false, new CloseableExecutorService(Executors.newSingleThreadExecutor(defaultThreadFactory), true)); }
/** * @param client the client * @param path path to watch * @param mode caching mode * @param threadFactory factory to use when creating internal threads * @deprecated use {@link #PathChildrenCache(CuratorFramework, String, boolean, ThreadFactory)} instead */ @Deprecated @SuppressWarnings("deprecation") public PathChildrenCache(CuratorFramework client, String path, PathChildrenCacheMode mode, ThreadFactory threadFactory) { this(client, path, mode != PathChildrenCacheMode.CACHE_PATHS_ONLY, false, new CloseableExecutorService(Executors.newSingleThreadExecutor(threadFactory), true)); }
public PathChildrenCache make(CuratorFramework curator, String path) { return new PathChildrenCache( curator, path, cacheData, compressed, new CloseableExecutorService(exec, shutdownExecutorOnClose) ); }
public PathChildrenCache make(CuratorFramework curator, String path) { return new PathChildrenCache( curator, path, cacheData, compressed, new CloseableExecutorService(exec, shutdownExecutorOnClose) ); }
private static CloseableExecutorService convertThreadFactory(ThreadFactory threadFactory) { Preconditions.checkNotNull(threadFactory, "threadFactory cannot be null"); return new CloseableExecutorService(Executors.newSingleThreadExecutor(threadFactory)); }
private static CloseableExecutorService convertThreadFactory(ThreadFactory threadFactory) { Preconditions.checkNotNull(threadFactory, "threadFactory cannot be null"); return new CloseableExecutorService(Executors.newSingleThreadExecutor(threadFactory)); }
private static CloseableExecutorService convertThreadFactory(ThreadFactory threadFactory) { Preconditions.checkNotNull(threadFactory, "threadFactory cannot be null"); return new CloseableExecutorService(Executors.newSingleThreadExecutor(threadFactory)); }
/** * @param client the client * @param leaderPath the path for this leadership group * @param threadFactory factory to use for making internal threads * @param executor the executor to run in * @param listener listener * @deprecated This constructor was poorly thought out. Custom executor is useless. Use this version instead: {@link #LeaderSelector(CuratorFramework, String, ExecutorService, LeaderSelectorListener)} */ @SuppressWarnings("UnusedParameters") @Deprecated public LeaderSelector(CuratorFramework client, String leaderPath, ThreadFactory threadFactory, Executor executor, LeaderSelectorListener listener) { this(client, leaderPath, new CloseableExecutorService(wrapExecutor(executor), true), listener); }
new CloseableExecutorService(Executors.newSingleThreadExecutor(leaderSelectorThreadFactory), true), new LeaderSelectorListenerAdapter() { @Override
this.closeableExecutor = new CloseableExecutorService(executor);