List of usage examples for com.google.common.util.concurrent ListeningScheduledExecutorService execute
void execute(Runnable command);
From source file:org.neoscoinj.core.PeerGroup.java
protected ListeningScheduledExecutorService createPrivateExecutor() { ListeningScheduledExecutorService result = MoreExecutors.listeningDecorator( new ScheduledThreadPoolExecutor(1, new DaemonThreadFactory("PeerGroup Thread"))); // Hack: jam the executor so jobs just queue up until the user calls start() on us. For example, adding a wallet // results in a bloom filter recalc being queued, but we don't want to do that until we're actually started. result.execute(new Runnable() { @Override/*from w ww .j av a 2 s. c o m*/ public void run() { Uninterruptibles.awaitUninterruptibly(executorStartupLatch); } }); return result; }
From source file:org.bitcoinj_extra.core.PeerGroup.java
protected ListeningScheduledExecutorService createPrivateExecutor() { ListeningScheduledExecutorService result = MoreExecutors.listeningDecorator( new ScheduledThreadPoolExecutor(1, new ContextPropagatingThreadFactory("PeerGroup Thread"))); // Hack: jam the executor so jobs just queue up until the user calls start() on us. For example, adding a wallet // results in a bloom filter recalc being queued, but we don't want to do that until we're actually started. result.execute(new Runnable() { @Override//from ww w .j av a2 s .c o m public void run() { Uninterruptibles.awaitUninterruptibly(executorStartupLatch); } }); return result; }