Java Code Examples for com.google.common.collect.Queues#newLinkedBlockingDeque()
The following examples show how to use
com.google.common.collect.Queues#newLinkedBlockingDeque() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PubSubClient.java From tracing-framework with BSD 3-Clause "New" or "Revised" License | 6 votes |
PubSubClient(String hostname, int port, int maxPendingMessages) throws IOException { this.hostname = hostname; this.port = port; this.maxPendingMessages = maxPendingMessages; if (maxPendingMessages <= 0) { this.pending = Queues.newLinkedBlockingDeque(); } else { this.pending = Queues.newLinkedBlockingDeque(maxPendingMessages); } this.selector = Selector.open(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { close(); } }); }
Example 2
Source File: DefaultDtsResourcMessageSender.java From dts with Apache License 2.0 | 5 votes |
private void registerBodyRequest(DtsResourceManager reousrceManager) { ResourceMessageHandler messageProcessor = new ResourceMessageHandler(reousrceManager); BlockingQueue<Runnable> clientThreadPoolQueue = Queues.newLinkedBlockingDeque(100); ExecutorService clientMessageExecutor = new ThreadPoolExecutor(nettyClientConfig.getClientCallbackExecutorThreads(), nettyClientConfig.getClientCallbackExecutorThreads(), 1000 * 60, TimeUnit.MILLISECONDS, clientThreadPoolQueue, new DtsThreadFactory("ResourceBodyRequestThread_")); this.remotingClient.registerProcessor(RequestCode.BODY_REQUEST, messageProcessor, clientMessageExecutor); }
Example 3
Source File: DefaultDtsResourcMessageSender.java From dts with Apache License 2.0 | 5 votes |
private void registerHeaderRequest(DtsResourceManager reousrceManager) { ResourceMessageHandler messageProcessor = new ResourceMessageHandler(reousrceManager); BlockingQueue<Runnable> clientThreadPoolQueue = Queues.newLinkedBlockingDeque(100); ExecutorService clientMessageExecutor = new ThreadPoolExecutor(nettyClientConfig.getClientCallbackExecutorThreads(), nettyClientConfig.getClientCallbackExecutorThreads(), 1000 * 60, TimeUnit.MILLISECONDS, clientThreadPoolQueue, new DtsThreadFactory("ResourceHeadRequestThread_")); this.remotingClient.registerProcessor(RequestCode.HEADER_REQUEST, messageProcessor, clientMessageExecutor); }
Example 4
Source File: DtsRemotingServer.java From dts with Apache License 2.0 | 5 votes |
private void registerBodyRequest() { DtsMessageProcessor messageProcessor = createMessageProcessor(); BlockingQueue<Runnable> resourceThreadPoolQueue = Queues.newLinkedBlockingDeque(10000); ExecutorService resourceMessageExecutor = new ServerFixedThreadPoolExecutor(cpus, cpus, 1000 * 60, TimeUnit.MILLISECONDS, resourceThreadPoolQueue, new DtsThreadFactory("ServerBodyThread_")); this.remotingServer.registerProcessor(RequestCode.BODY_REQUEST, messageProcessor, resourceMessageExecutor); }
Example 5
Source File: DtsRemotingServer.java From dts with Apache License 2.0 | 5 votes |
private void registerHeaderRequest() { DtsMessageProcessor messageProcessor = createMessageProcessor(); BlockingQueue<Runnable> clientThreadPoolQueue = Queues.newLinkedBlockingDeque(10000); ExecutorService clientMessageExecutor = new ServerFixedThreadPoolExecutor(cpus * headerRequestCorePoolSizeCpuTimes, cpus * headerRequestMaximumPoolSizeCpuTimes, headerRequestKeepaliveTime, TimeUnit.MILLISECONDS, clientThreadPoolQueue, new DtsThreadFactory("ServerHeadRequestThread_")); this.remotingServer.registerProcessor(RequestCode.HEADER_REQUEST, messageProcessor, clientMessageExecutor); }
Example 6
Source File: VersionIdGenerator.java From quantumdb with Apache License 2.0 | 5 votes |
private Set<String> index() { Set<String> visited = Sets.newHashSet(); Queue<Version> toVisit = Queues.newLinkedBlockingDeque(); toVisit.add(rootVersion); while (!toVisit.isEmpty()) { Version current = toVisit.poll(); if (visited.add(current.getId()) && current.getChild() != null) { toVisit.add(current.getChild()); } } return visited; }
Example 7
Source File: BatchScannerSession.java From datawave with Apache License 2.0 | 3 votes |
/** * Constructor * * @param tableName * incoming table name * @param auths * set of authorizations. * @param delegator * scanner queue * @param maxResults */ public BatchScannerSession(String tableName, Set<Authorizations> auths, ResourceQueue delegator, int maxResults, Query settings, ScannerOptions options, Collection<Range> ranges) { super(tableName, auths, delegator, maxResults, settings); Preconditions.checkNotNull(delegator); localTableName = tableName; localAuths = auths; delegatorReference = super.sessionDelegator; scannerBatches = Iterators.emptyIterator(); currentBatch = Queues.newLinkedBlockingDeque(); setThreads(1); listenerService = Executors.newFixedThreadPool(1); addListener(new BatchScannerListener(), listenerService); serverFailureMap = Maps.newConcurrentMap(); serverMap = Maps.newConcurrentMap(); }