@Override public E peekLast() { synchronized (mutex) { return delegate().peekLast(); } }
@Override public E peekLast() { synchronized (mutex) { return delegate().peekLast(); } }
@Override public E peekLast() { return delegate().peekLast(); }
public Chunk getLatestChunk() { final WeakReference<Chunk> chunk = chunks.peekLast(); if (chunk != null) { return chunk.get(); } return null; }
/** * Is the last character the one expected? */ boolean isLastChar(char expectedChar) { return prevTwoChars.size() >= 1 && prevTwoChars.peekLast().equals(expectedChar); }
@Override public E peekLast() { synchronized (mutex) { return delegate().peekLast(); } }
public static <V> V peekLast(Deque<V> queue) { if (queue instanceof BTraceDeque || queue.getClass().getClassLoader() == null) { return queue.peekLast(); } else { throw new IllegalArgumentException(); } }
@Override public E peekLast() { return delegate().peekLast(); }
private List<ErrorMessage> _getErrorMessages(final boolean afterMark) { if (afterMark) { final Integer _pos = mark.peekLast(); final int markedPos = (_pos == null) ? -1 : _pos; if (markedPos >= 0 && markedPos < issues.size()) { return Collections.unmodifiableList(new ArrayList<ErrorMessage>(issues.subList(markedPos, issues.size()))); } // else return all errors } return Collections.unmodifiableList(new ArrayList<ErrorMessage>(issues)); }
private List<ErrorMessage> _getErrorMessages(final boolean afterMark) { if (afterMark) { final Integer _pos = mark.peekLast(); final int markedPos = (_pos == null) ? -1 : _pos; if (markedPos >= 0 && markedPos < issues.size()) { return Collections.unmodifiableList(new ArrayList<ErrorMessage>(issues.subList(markedPos, issues.size()))); } // else return all errors } return Collections.unmodifiableList(new ArrayList<ErrorMessage>(issues)); }
@Override public E peekLast() { return delegate().peekLast(); }
@Override public E peekLast() { assertTrue(Thread.holdsLock(mutex)); return delegate.peekLast(); }
public void addInstrumentor(BTraceProbe bp, ClassLoader cl) { if (cr != null && bp != null) { synchronized(instrumentors) { Instrumentor top = instrumentors.peekLast(); ClassVisitor parent = top != null ? top : this; Instrumentor i = Instrumentor.create(cr, bp, parent, cl); if (i != null) { instrumentors.add(i); } } } }
@Override public E peekLast() { synchronized (mutex) { return delegate().peekLast(); } }
/** * Submit a fetch task if remainingBytes is smaller than prefetchTriggerBytes. */ private void fetchIfNeeded(long remainingBytes) { if ((fetchFutures.isEmpty() || fetchFutures.peekLast().isDone()) && remainingBytes <= prefetchConfig.getPrefetchTriggerBytes()) { Future<Void> fetchFuture = fetchExecutor.submit(() -> { fetch(); return null; }); fetchFutures.add(fetchFuture); } }
private void initPartitions() { partitionIds = partitionIdsState.get(PARTITION_IDS_KEY, new LinkedList<>()); if (partitionIds.isEmpty()) { partitionIds.add(0L); partitionIdsState.put(PARTITION_IDS_KEY, partitionIds); } latestPartitionId = partitionIds.peekLast(); latestPartition = cache.pinAndGet(latestPartitionId); }
public byte[] instrument() { boolean hit = false; synchronized(instrumentors) { if (instrumentors.isEmpty()) return null; ClassVisitor top = instrumentors.peekLast(); InstrumentUtils.accept(cr, top != null ? top : this); for(Instrumentor i : instrumentors) { hit |= i.hasMatch(); } } return hit ? this.toByteArray() : null; }
private void checkDeque(Deque<? extends E> deque, DescriptionBuilder builder) { builder.expectThat("empty deque", deque.peekFirst(), is(nullValue())); builder.expectThat("empty deque", deque.peekLast(), is(nullValue())); builder.expectThat("empty deque", deque.descendingIterator().hasNext(), is(false)); }
/** * Try to append to a ProducerBatch. * * If it is full, we return null and a new batch is created. We also close the batch for record appends to free up * resources like compression buffers. The batch will be fully closed (ie. the record batch headers will be written * and memory records built) in one of the following cases (whichever comes first): right before send, * if it is expired, or when the producer is closed. */ private RecordAppendResult tryAppend(long timestamp, byte[] key, byte[] value, Header[] headers, Callback callback, Deque<ProducerBatch> deque) { ProducerBatch last = deque.peekLast(); if (last != null) { FutureRecordMetadata future = last.tryAppend(timestamp, key, value, headers, callback, time.milliseconds()); if (future == null) last.closeForRecordAppends(); else return new RecordAppendResult(future, deque.size() > 1 || last.isFull(), false); } return null; }
create().getLast(); create().peekFirst(); create().peekLast(); create().removeFirstOccurrence("e"); create().removeLastOccurrence("e");