本文整理了Java中java.util.concurrent.LinkedBlockingDeque.peek()
方法的一些代码示例,展示了LinkedBlockingDeque.peek()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedBlockingDeque.peek()
方法的具体详情如下:
包路径:java.util.concurrent.LinkedBlockingDeque
类名称:LinkedBlockingDeque
方法名:peek
暂无
代码示例来源:origin: jersey/jersey
@Override
public int available() throws IOException {
InputStream peek = isList.peek();
if (peek != null) {
return peek.available();
}
return 0;
}
代码示例来源:origin: prestodb/presto
checkState(pageBuffer.add(NO_MORE_PAGES), "Could not add no more pages marker");
if (pageBuffer.peek() == NO_MORE_PAGES) {
close();
代码示例来源:origin: prestodb/presto
public synchronized ListenableFuture<?> isBlocked()
{
if (isClosed() || isFailed() || pageBuffer.peek() != null) {
return Futures.immediateFuture(true);
}
SettableFuture<?> future = SettableFuture.create();
blockedCallers.add(future);
return future;
}
代码示例来源:origin: jersey/jersey
@Override
public boolean isEndOfInput() throws Exception {
if (!open) {
return true;
}
ByteBuffer peek = queue.peek();
if ((peek != null && peek == VOID)) {
queue.remove(); // VOID from the top.
open = false;
removeCloseListener();
return true;
}
return false;
}
代码示例来源:origin: prestodb/presto
private SerializedPage postProcessPage(SerializedPage page)
{
checkState(!Thread.holdsLock(this), "Can not get next page while holding a lock on this");
if (page == null) {
return null;
}
if (page == NO_MORE_PAGES) {
// mark client closed; close() will add the end marker
close();
notifyBlockedCallers();
// don't return end of stream marker
return null;
}
synchronized (this) {
if (!closed.get()) {
bufferRetainedSizeInBytes -= page.getRetainedSizeInBytes();
systemMemoryContext.setBytes(bufferRetainedSizeInBytes);
if (pageBuffer.peek() == NO_MORE_PAGES) {
close();
}
}
}
scheduleRequestIfNecessary();
return page;
}
代码示例来源:origin: NightscoutFoundation/xDrip
public static String getFirstQueueItemName() {
synchronized (commandQueue) {
final Ob1Work item = commandQueue.peek();
return item != null ? item.text : "";
}
}
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
@Override
public boolean checkForOutOfMemory() {
return buffer.peek().isOutOfMemory();
}
代码示例来源:origin: jamorham/xDrip-plus
public static String getFirstQueueItemName() {
synchronized (commandQueue) {
final Ob1Work item = commandQueue.peek();
return item != null ? item.text : "";
}
}
代码示例来源:origin: jamorham/xDrip-plus
public static String getFirstQueueItemName() {
synchronized (commandQueue) {
final Ob1Work item = commandQueue.peek();
return item != null ? item.text : "";
}
}
代码示例来源:origin: org.jboss.seam.transaction/seam-transaction
public T peek() {
LinkedBlockingDeque<T> queue = stack.get();
if (queue == null) {
return null;
}
return queue.peek();
}
代码示例来源:origin: NightscoutFoundation/xDrip
public static boolean deleteFirstQueueCalibration(final int mgdl) {
synchronized (commandQueue) {
final Ob1Work item = commandQueue.peek();
if (item != null) {
if (item.msg instanceof CalibrateTxMessage) {
final CalibrateTxMessage cal = (CalibrateTxMessage) item.msg;
if (mgdl == -1 || cal.glucose == mgdl) {
commandQueue.poll(); // eat this entry
return true;
}
}
}
}
return false;
}
代码示例来源:origin: jamorham/xDrip-plus
public static boolean deleteFirstQueueCalibration(final int mgdl) {
synchronized (commandQueue) {
final Ob1Work item = commandQueue.peek();
if (item != null) {
if (item.msg instanceof CalibrateTxMessage) {
final CalibrateTxMessage cal = (CalibrateTxMessage) item.msg;
if (mgdl == -1 || cal.glucose == mgdl) {
commandQueue.poll(); // eat this entry
return true;
}
}
}
}
return false;
}
代码示例来源:origin: jamorham/xDrip-plus
public static boolean deleteFirstQueueCalibration(final int mgdl) {
synchronized (commandQueue) {
final Ob1Work item = commandQueue.peek();
if (item != null) {
if (item.msg instanceof CalibrateTxMessage) {
final CalibrateTxMessage cal = (CalibrateTxMessage) item.msg;
if (mgdl == -1 || cal.glucose == mgdl) {
commandQueue.poll(); // eat this entry
return true;
}
}
}
}
return false;
}
代码示例来源:origin: dhanji/sitebricks
MailClient.WireError lastError() {
return errorStack.peek() != null ? errorStack.pop() : null;
}
代码示例来源:origin: io.prestosql/presto-main
public synchronized ListenableFuture<?> isBlocked()
{
if (isClosed() || isFailed() || pageBuffer.peek() != null) {
return Futures.immediateFuture(true);
}
SettableFuture<?> future = SettableFuture.create();
blockedCallers.add(future);
return future;
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
public synchronized ListenableFuture<?> isBlocked()
{
if (isClosed() || isFailed() || pageBuffer.peek() != null) {
return Futures.immediateFuture(true);
}
SettableFuture<?> future = SettableFuture.create();
blockedCallers.add(future);
return future;
}
代码示例来源:origin: prestosql/presto
public synchronized ListenableFuture<?> isBlocked()
{
if (isClosed() || isFailed() || pageBuffer.peek() != null) {
return Futures.immediateFuture(true);
}
SettableFuture<?> future = SettableFuture.create();
blockedCallers.add(future);
return future;
}
代码示例来源:origin: bitmovin/bitcodin-android-demo
/**
* Reads data from the front of the rolling buffer.
*
* @param absolutePosition The absolute position from which data should be read.
* @param target The buffer into which data should be written.
* @param length The number of bytes to read.
*/
private void readData(long absolutePosition, ByteBuffer target, int length) {
int remaining = length;
while (remaining > 0) {
dropDownstreamTo(absolutePosition);
int positionInAllocation = (int) (absolutePosition - totalBytesDropped);
int toCopy = Math.min(remaining, allocationLength - positionInAllocation);
Allocation allocation = dataQueue.peek();
target.put(allocation.data, allocation.translateOffset(positionInAllocation), toCopy);
absolutePosition += toCopy;
remaining -= toCopy;
}
}
代码示例来源:origin: prestosql/presto
private SerializedPage postProcessPage(SerializedPage page)
{
checkState(!Thread.holdsLock(this), "Can not get next page while holding a lock on this");
if (page == null) {
return null;
}
if (page == NO_MORE_PAGES) {
// mark client closed; close() will add the end marker
close();
notifyBlockedCallers();
// don't return end of stream marker
return null;
}
synchronized (this) {
if (!closed.get()) {
bufferRetainedSizeInBytes -= page.getRetainedSizeInBytes();
systemMemoryContext.setBytes(bufferRetainedSizeInBytes);
if (pageBuffer.peek() == NO_MORE_PAGES) {
close();
}
}
}
scheduleRequestIfNecessary();
return page;
}
代码示例来源:origin: io.prestosql/presto-main
private SerializedPage postProcessPage(SerializedPage page)
{
checkState(!Thread.holdsLock(this), "Can not get next page while holding a lock on this");
if (page == null) {
return null;
}
if (page == NO_MORE_PAGES) {
// mark client closed; close() will add the end marker
close();
notifyBlockedCallers();
// don't return end of stream marker
return null;
}
synchronized (this) {
if (!closed.get()) {
bufferRetainedSizeInBytes -= page.getRetainedSizeInBytes();
systemMemoryContext.setBytes(bufferRetainedSizeInBytes);
if (pageBuffer.peek() == NO_MORE_PAGES) {
close();
}
}
}
scheduleRequestIfNecessary();
return page;
}
内容来源于网络,如有侵权,请联系作者删除!