void checkIn(final Collection<byte[]> buffers) { queue.addAll(buffers); }
/** * Concurrency note: unblocks {@link #waitForRestartSolverDecision()}. * @param problemFactChangeList never null * @return as specified by {@link Collection#add} */ public synchronized <Solution_> boolean addProblemFactChanges(List<ProblemFactChange<Solution_>> problemFactChangeList) { boolean added = problemFactChangeQueue.addAll(problemFactChangeList); notifyAll(); return added; }
public void addAll(final Collection<MockFlowFile> flowFiles) { writeLock.lock(); try { queue.addAll(flowFiles); } finally { writeLock.unlock(); } }
public ResourcePool(int poolSize, List<T> initializedResources) { this.semaphore = new Semaphore(poolSize, true); this.resources = new LinkedBlockingQueue<>(poolSize); this.resources.addAll(initializedResources); }
public FileRawInput(String path) { File folder = new File(path); File[] files = folder.listFiles((File dir, String name) -> { return name.endsWith(".html"); }); if (files != null) { queue.addAll(Arrays.asList(files)); } }
private void flush(List<JobLogPo> batch) { boolean flushSuccess = false; try { delegate.log(batch); flushSuccess = true; } finally { if (!flushSuccess) { memoryQueue.addAll(batch); } batch.clear(); } }
@Override protected Callable<Integer> createReplicator(List<Entry> entries, int ordinal) { return () -> { entryQueue.addAll(entries); return ordinal; }; }
private void flush(List<JobLogPo> batch) { boolean flushSuccess = false; try { delegate.log(batch); flushSuccess = true; } finally { if (!flushSuccess) { memoryQueue.addAll(batch); } batch.clear(); } }
TestHttpClient(List<ListenableFuture> resultsList) { results = new LinkedBlockingQueue<>(); results.addAll(resultsList); }
TestHttpClient(List<ListenableFuture> resultsList) { results = new LinkedBlockingQueue<>(); results.addAll(resultsList); }
/** * Resume the queue if the queue is paused. * * @see #pause() */ public void resume() { synchronized (finishCallback) { if (!paused) { FileDownloadLog.w(this, "require resume this queue(remain %d), but it is" + " still running", mTasks.size()); return; } paused = false; mTasks.addAll(pausedList); pausedList.clear(); if (workingTask == null) { sendNext(); } else { workingTask.addFinishListener(finishCallback); workingTask.start(); } } }
private void cleanupExpiredSockets() { for (final BlockingQueue<EndpointConnection> connectionQueue : connectionQueueMap.values()) { final List<EndpointConnection> connections = new ArrayList<>(); EndpointConnection connection; while ((connection = connectionQueue.poll()) != null) { // If the socket has not been used in 10 seconds, shut it down. final long lastUsed = connection.getLastTimeUsed(); if (lastUsed < System.currentTimeMillis() - idleExpirationMillis) { try { connection.getSocketClientProtocol().shutdown(connection.getPeer()); } catch (final Exception e) { logger.debug("Failed to shut down {} using {} due to {}", connection.getSocketClientProtocol(), connection.getPeer(), e); } terminate(connection); } else { connections.add(connection); } } connectionQueue.addAll(connections); } }
private void prepareResume() throws Exception { Collection<Long> versionsToResume = transferManager.loadPendingTransactionList(); boolean hasVersionsToResume = versionsToResume != null && versionsToResume.size() > 0; if (hasVersionsToResume) { logger.log(Level.INFO, "Found local transaction to resume."); logger.log(Level.INFO, "Attempting to find transactionRemoteFile"); remoteTransactionsToResume = attemptResumeTransactions(versionsToResume); Collection<DatabaseVersion> remoteDatabaseVersionsToResume = attemptResumeDatabaseVersions(versionsToResume); resuming = remoteDatabaseVersionsToResume != null && remoteTransactionsToResume != null && remoteDatabaseVersionsToResume.size() == remoteTransactionsToResume.size(); if (resuming) { databaseVersionQueue.addAll(remoteDatabaseVersionsToResume); databaseVersionQueue.add(new DatabaseVersion()); // Empty database version is the stopping marker transactionRemoteFileToResume = attemptResumeTransactionRemoteFile(); } else { transferManager.clearResumableTransactions(); } } else { transferManager.clearResumableTransactions(); } }
this.peekedEventsProcessing.addAll(this.peekedEvents); this.peekedEventsProcessingInProgress = true; addPreviouslyPeekedEvents(batch, batchSize);
@OnScheduled @Override public void onScheduled(ProcessContext context) throws IOException { super.onScheduled(context); events.addAll(mockEvents); }
@OnScheduled @Override public void onScheduled(ProcessContext context) throws IOException { super.onScheduled(context); events.addAll(mockEvents); }
fileQueue.addAll(listing);
return; processing.addAll(files); } finally { queueLock.unlock();
claimQueue.addAll(claimsToAdd);
} finally { if (!addBack.isEmpty()) { connectionQueue.addAll(addBack); addBack.clear();