private boolean offer0(Channel channel, Object partitionKey, long now) { ConcurrentLinkedDeque<IdleChannel> partition = partitions.get(partitionKey); if (partition == null) { partition = partitions.computeIfAbsent(partitionKey, pk -> new ConcurrentLinkedDeque<>()); } return partition.offerFirst(new IdleChannel(channel, now)); }
/** * Puts exception into queue. * Thread-safe. * * @param msg Message that describe reason why error was suppressed. * @param e Exception. */ public void onException(String msg, Throwable e) { q.offerFirst( new ExceptionInfo( errCnt.incrementAndGet(), e, msg, Thread.currentThread().getId(), Thread.currentThread().getName(), U.currentTimeMillis())); // Remove extra entries. int delta = q.size() - maxSize; for (int i = 0; i < delta && q.size() > maxSize; i++) q.pollLast(); }
_stack.offerFirst(this);
private boolean executeWithRequeueOnNoConnection(FutureOperation operation) { logger.debug("Queued operation {} attempting to be executed.", System.identityHashCode(operation)); // Attempt to run boolean gotConnection = this.execute(operation, null); // If we can't get a connection, put it back at the beginning of the queue if (!gotConnection) { logger.debug("Queued operation {} wasn't executed, no connection available, requeuing operation.", System.identityHashCode(operation)); operationQueue.offerFirst(operation); } else { operationQueuePermits.release(); } verifyQueueStatus(); return gotConnection; }
/** * Puts exception into queue. * Thread-safe. * * @param msg Message that describe reason why error was suppressed. * @param e Exception. */ public void onException(String msg, Throwable e) { q.offerFirst( new ExceptionInfo( errCnt.incrementAndGet(), e, msg, Thread.currentThread().getId(), Thread.currentThread().getName(), U.currentTimeMillis())); // Remove extra entries. int delta = q.size() - maxSize; for (int i = 0; i < delta && q.size() > maxSize; i++) q.pollLast(); }
_stack.offerFirst(this);