private CollectionReference currentCollection() { return collectionReferenceStack.peekFirst(); }
protected ExpandingFetchSource currentSource() { return fetchSourceStack.peekFirst(); }
/** * Retrieves, but does not remove, the head of the queue represented by * this deque, or returns <tt>null</tt> if this deque is empty. * * <p>This method is equivalent to {@link #peekFirst}. * * @return the head of the queue represented by this deque, or * <tt>null</tt> if this deque is empty */ public E peek() { return peekFirst(); }
private static boolean sendFirst(final ArrayDeque<BooleanSupplier> responseQueue) { return responseQueue.peekFirst().getAsBoolean(); }
private void tryEmitOneFailedBuffer() { FailedBuffer failedBuffer = failedBuffers.peekFirst(); if (failedBuffer != null) { if (sendWithRetries(failedBuffer.buffer, failedBuffer.length, failedBuffer.eventCount, false)) { // Remove from the queue of failed buffer. failedBuffers.pollFirst(); approximateFailedBuffersCount.decrementAndGet(); // Don't add the failed buffer back to the buffersToReuse queue here, because in a situation when we were not // able to emit events for a while we don't have a way to discard buffers that were used to accumulate events // during that period, if they are added back to buffersToReuse. For instance it may result in having 100 // buffers in rotation even if we need just 2. } } }
private void updatePlaybackInfo( PlaybackInfo playbackInfo, boolean positionDiscontinuity, @Player.DiscontinuityReason int positionDiscontinuityReason, @Player.TimelineChangeReason int timelineChangeReason, boolean seekProcessed, boolean playWhenReadyChanged) { boolean isRunningRecursiveListenerNotification = !pendingPlaybackInfoUpdates.isEmpty(); pendingPlaybackInfoUpdates.addLast( new PlaybackInfoUpdate( playbackInfo, /* previousPlaybackInfo= */ this.playbackInfo, listeners, trackSelector, positionDiscontinuity, positionDiscontinuityReason, timelineChangeReason, seekProcessed, playWhenReady, playWhenReadyChanged)); // Assign playback info immediately such that all getters return the right values. this.playbackInfo = playbackInfo; if (isRunningRecursiveListenerNotification) { return; } while (!pendingPlaybackInfoUpdates.isEmpty()) { pendingPlaybackInfoUpdates.peekFirst().notifyListeners(); pendingPlaybackInfoUpdates.removeFirst(); } }
public void pop() { pathStack.removeFirst(); PropertyPath newHead = pathStack.peekFirst(); MDC.put( MDC_KEY, extractFullPath( newHead ) ); } }
MediaCodecInfo codecInfo = availableCodecInfos.peekFirst(); if (!shouldInitCodec(codecInfo)) { return false;
public void putFirstPrimary(Integer eventCount) { if ((queue.peekFirst() == null) || queue.getFirst().intValue() < 0) { queue.addFirst(new MutableInteger(eventCount)); } else { queue.getFirst().add(eventCount); } }
public void putFirstOverflow(Integer eventCount) { if ((queue.peekFirst() == null) || queue.getFirst().intValue() > 0) { queue.addFirst(new MutableInteger(-eventCount)); } else { queue.getFirst().add(-eventCount); } overflowCounter += eventCount; }
while ((cbc = pendingCheckpoints.peekFirst()) != null && cbc.checkpointId() < checkpointId) { pendingCheckpoints.removeFirst();
/** * Retrieves, but does not remove, the head of the queue represented by * this deque, or returns <tt>null</tt> if this deque is empty. * * <p>This method is equivalent to {@link #peekFirst}. * * @return the head of the queue represented by this deque, or * <tt>null</tt> if this deque is empty */ public E peek() { return peekFirst(); }
/** * Retrieves, but does not remove, the head of the queue represented by * this deque, or returns <tt>null</tt> if this deque is empty. * * <p>This method is equivalent to {@link #peekFirst}. * * @return the head of the queue represented by this deque, or * <tt>null</tt> if this deque is empty */ public E peek() { return peekFirst(); }
/** * Clean up points that don't count any more (are before our * rolling window) from our current queue of points. */ private void cleanupOldPoints() { Date cutoffTime = new Date(new Date().getTime() - windowSizeMs); while (!currentPoints.isEmpty() && currentPoints.peekFirst().getEventTime().before(cutoffTime)) { currentPoints.removeFirst(); } }
/** * Clean up points that don't count any more (are before our * rolling window) from our current queue of points. */ private void cleanupOldPoints() { Date cutoffTime = new Date(new Date().getTime() - windowSizeMs); while (!currentPoints.isEmpty() && currentPoints.peekFirst().getEventTime().before(cutoffTime)) { currentPoints.removeFirst(); } }
@Override public String next() { checkEmpty(availableEndpoints); if (availableEndpoints.size() == 1) { return availableEndpoints.peekFirst(); } return roundRobin(); }
/** Return source location for the first entry in all branches. */ SourceLocation getSourceLocation() { removeEmptyDeque(); if (branches.isEmpty()) { return SourceLocation.UNKNOWN; } ConditionalBranch branch = branches.get(0); // removeEmptyDeque guarantees that the deque is not empty. return branch.deque().peekFirst().getSourceLocation(); }
/** Return source location for the first entry in all branches. */ SourceLocation getSourceLocation() { removeEmptyDeque(); if (branches.isEmpty()) { return SourceLocation.UNKNOWN; } ConditionalBranch branch = branches.get(0); // removeEmptyDeque guarantees that the deque is not empty. return branch.deque().peekFirst().getSourceLocation(); }
public void putFirstOverflow(Integer eventCount) { if ((queue.peekFirst() == null) || queue.getFirst().intValue() > 0) { queue.addFirst(new MutableInteger(-eventCount)); } else { queue.getFirst().add(-eventCount); } overflowCounter += eventCount; }