当前位置: 首页>>代码示例>>Java>>正文


Java ThreadUtils.newThreadFactory方法代码示例

本文整理汇总了Java中org.apache.curator.utils.ThreadUtils.newThreadFactory方法的典型用法代码示例。如果您正苦于以下问题:Java ThreadUtils.newThreadFactory方法的具体用法?Java ThreadUtils.newThreadFactory怎么用?Java ThreadUtils.newThreadFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.curator.utils.ThreadUtils的用法示例。


在下文中一共展示了ThreadUtils.newThreadFactory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: internalListen

import org.apache.curator.utils.ThreadUtils; //导入方法依赖的package包/类
protected void internalListen(ServiceDescription description) throws Exception {
    ServiceCache serviceCache = null;

    synchronized (serviceCacheMap) {
        serviceCache = serviceCacheMap.get(description.getName());
        if (serviceCache == null) {
            String providerPath = pathForProviders(description.getName());
            ThreadFactory threadFactory = ThreadUtils.newThreadFactory("ServiceDiscovery");
            serviceCache = new ServiceCache(client, providerPath, threadFactory).build();
            serviceCacheMap.put(description.getName(), serviceCache);
        }
    }

    serviceCache.addConsumer(description);
}
 
开发者ID:dinstone,项目名称:jrpc,代码行数:16,代码来源:ZookeeperServiceDiscovery.java

示例2: ZKConsumerLeader

import org.apache.curator.utils.ThreadUtils; //导入方法依赖的package包/类
ZKConsumerLeader(final ZKHolder zkHolder, final String consumerName, final ZKMember member) {
    this.zkHolder = requireNonNull(zkHolder, "zkHolder must not be null");
    this.consumerName = requireNonNull(consumerName, "consumerName must not be null");
    this.member = requireNonNull(member, "member must not be null");

    this.leaderSelectorThreadFactory = ThreadUtils.newThreadFactory("LeaderSelector-" + consumerName);
}
 
开发者ID:zalando-nakadi,项目名称:paradox-nakadi-consumer,代码行数:8,代码来源:ZKConsumerLeader.java

示例3: ConnectionStateManager

import org.apache.curator.utils.ThreadUtils; //导入方法依赖的package包/类
/**
 * @param client        the client
 * @param threadFactory thread factory to use or null for a default
 * @param sessionTimeoutMs the ZK session timeout in milliseconds
 * @param sessionExpirationPercent percentage of negotiated session timeout to use when simulating a session timeout. 0 means don't simulate at all
 */
public ConnectionStateManager(CuratorFramework client, ThreadFactory threadFactory, int sessionTimeoutMs, int sessionExpirationPercent)
{
    this.client = client;
    this.sessionTimeoutMs = sessionTimeoutMs;
    this.sessionExpirationPercent = sessionExpirationPercent;
    if ( threadFactory == null )
    {
        threadFactory = ThreadUtils.newThreadFactory("ConnectionStateManager");
    }
    service = Executors.newSingleThreadExecutor(threadFactory);
}
 
开发者ID:apache,项目名称:curator,代码行数:18,代码来源:ConnectionStateManager.java

示例4: getThreadFactory

import org.apache.curator.utils.ThreadUtils; //导入方法依赖的package包/类
private ThreadFactory getThreadFactory(CuratorFrameworkFactory.Builder builder)
{
    ThreadFactory threadFactory = builder.getThreadFactory();
    if ( threadFactory == null )
    {
        threadFactory = ThreadUtils.newThreadFactory("Framework");
    }
    return threadFactory;
}
 
开发者ID:apache,项目名称:curator,代码行数:10,代码来源:CuratorFrameworkImpl.java

示例5: CustomServiceProvider

import org.apache.curator.utils.ThreadUtils; //导入方法依赖的package包/类
public CustomServiceProvider(ServiceDiscoveryImpl<T> discovery, String basePath, String serviceName,
                             ProviderStrategy<T> providerStrategy, IDiscoveryBackupManager discoveryStacksBackupManager, IInstanceWeigher<T> weighter) {
    this(discovery, basePath, serviceName, providerStrategy, ThreadUtils.newThreadFactory("CustomServiceProvider: " + basePath + serviceName),
            new ArrayList<InstanceFilter<T>>(), discoveryStacksBackupManager, weighter);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:6,代码来源:CustomServiceProvider.java


注:本文中的org.apache.curator.utils.ThreadUtils.newThreadFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。