• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ContextPropagatingThreadFactory类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.bitcoinj.utils.ContextPropagatingThreadFactory的典型用法代码示例。如果您正苦于以下问题:Java ContextPropagatingThreadFactory类的具体用法?Java ContextPropagatingThreadFactory怎么用?Java ContextPropagatingThreadFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ContextPropagatingThreadFactory类属于org.bitcoinj.utils包,在下文中一共展示了ContextPropagatingThreadFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startBackgroundProcessing

点赞 3

import org.bitcoinj.utils.ContextPropagatingThreadFactory; //导入依赖的package包/类
public boolean startBackgroundProcessing()
{
    if(backgroundThread == null)
    {
        threadCheckDarkSendPool = new ThreadCheckDarkSendPool();
        backgroundThread = new ContextPropagatingThreadFactory("dash-privatesend").newThread(threadCheckDarkSendPool);
        backgroundThread.start();
        return true;
    }
    else if(backgroundThread.getState() == Thread.State.TERMINATED) {
        //if the thread was stopped, start it again
        backgroundThread = new ContextPropagatingThreadFactory("dash-privatesend").newThread(threadCheckDarkSendPool);
        backgroundThread.start();
    }
    return false;
}
 

开发者ID:HashEngineering,
项目名称:dashj,
代码行数:17,
代码来源:DarkSendPool.java

示例2: WalletService

点赞 2

import org.bitcoinj.utils.ContextPropagatingThreadFactory; //导入依赖的package包/类
public WalletService() {
    walletServiceBinder = new WalletServiceBinder();
    walletEventListener = new CoinbleskWalletEventListener();
    bitcoinjThreadFactory = new ContextPropagatingThreadFactory("WalletServiceThreads");

    addressHashes = new ConcurrentHashMap<>();
    addresses = new ConcurrentSkipListSet<>(new LockTime.TimeCreatedComparator(true));
}
 

开发者ID:coinblesk,
项目名称:coinblesk-client-gui,
代码行数:9,
代码来源:WalletService.java

示例3: addConfidenceChangedListener

点赞 2

import org.bitcoinj.utils.ContextPropagatingThreadFactory; //导入依赖的package包/类
/**
 * Add a listener that gets executed when the confidence of a transaction changes.
 * @param listener
 */
public void addConfidenceChangedListener(TransactionConfidenceEventListener listener) {
	// Use a custom thread pool to speed up the processing of transactions.
	// Queue is blocking and limited to 10'000
	// to avoid memory exhaustion. After threshold is reached, the
	// CallerRunsPolicy() forces blocking behavior.
	ContextPropagatingThreadFactory factory = new ContextPropagatingThreadFactory("listenerFactory");
	Executor listenerExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), Runtime
		.getRuntime().availableProcessors(), 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(10000),
		factory, new ThreadPoolExecutor.CallerRunsPolicy());

	wallet.addTransactionConfidenceEventListener(listenerExecutor, listener);
}
 

开发者ID:coinblesk,
项目名称:coinblesk-server,
代码行数:17,
代码来源:WalletService.java

示例4: createExecutor

点赞 2

import org.bitcoinj.utils.ContextPropagatingThreadFactory; //导入依赖的package包/类
@Override
protected ExecutorService createExecutor() {
    // Attempted workaround for reported bugs on Linux in which gethostbyname does not appear to be properly
    // thread safe and can cause segfaults on some libc versions.
    if (Utilities.isLinux())
        return Executors.newSingleThreadExecutor(new ContextPropagatingThreadFactory("DNS seed lookups"));
    else
        return Executors.newFixedThreadPool(seeds.size(), new DaemonThreadFactory("DNS seed lookups"));
}
 

开发者ID:bisq-network,
项目名称:exchange,
代码行数:10,
代码来源:Socks5DnsDiscovery.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)