本文整理了Java中java.util.concurrent.LinkedBlockingDeque.pollFirst()
方法的一些代码示例,展示了LinkedBlockingDeque.pollFirst()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedBlockingDeque.pollFirst()
方法的具体详情如下:
包路径:java.util.concurrent.LinkedBlockingDeque
类名称:LinkedBlockingDeque
方法名:pollFirst
暂无
代码示例来源:origin: robovm/robovm
public E poll() {
return pollFirst();
}
代码示例来源:origin: robovm/robovm
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
return pollFirst(timeout, unit);
}
代码示例来源:origin: robovm/robovm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E removeFirst() {
E x = pollFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: jersey/jersey
private void release() {
Reference<ShutdownHook> listenerRef;
while ((listenerRef = shutdownHooks.pollFirst()) != null) {
JerseyClient.ShutdownHook listener = listenerRef.get();
if (listener != null) {
try {
listener.onShutdown();
} catch (Throwable t) {
LOG.log(Level.WARNING, LocalizationMessages.ERROR_SHUTDOWNHOOK_CLOSE(listenerRef.getClass().getName()), t);
}
}
}
}
代码示例来源:origin: jersey/jersey
private void release() {
Reference<ShutdownHook> listenerRef;
while ((listenerRef = shutdownHooks.pollFirst()) != null) {
JerseyClient.ShutdownHook listener = listenerRef.get();
if (listener != null) {
try {
listener.onShutdown();
} catch (Throwable t) {
LOG.log(Level.WARNING, LocalizationMessages.ERROR_SHUTDOWNHOOK_CLOSE(listenerRef.getClass().getName()), t);
}
}
}
}
代码示例来源:origin: org.glassfish.jersey.core/jersey-client
private void release() {
Reference<ShutdownHook> listenerRef;
while ((listenerRef = shutdownHooks.pollFirst()) != null) {
JerseyClient.ShutdownHook listener = listenerRef.get();
if (listener != null) {
try {
listener.onShutdown();
} catch (Throwable t) {
LOG.log(Level.WARNING, LocalizationMessages.ERROR_SHUTDOWNHOOK_CLOSE(listenerRef.getClass().getName()), t);
}
}
}
}
代码示例来源:origin: h2oai/h2o-2
private static ByteBuffer bbMake() {
while( true ) { // Repeat loop for DBB OutOfMemory errors
ByteBuffer bb;
try { bb = BBS.pollFirst(0,TimeUnit.SECONDS); }
catch( InterruptedException e ) { throw Log.errRTExcept(e); }
if( bb != null ) {
bbstats(BBCACHE);
return bb;
}
try {
bb = ByteBuffer.allocateDirect(BBSIZE).order(ByteOrder.nativeOrder());
bbstats(BBMAKE);
return bb;
} catch( OutOfMemoryError oome ) {
// java.lang.OutOfMemoryError: Direct buffer memory
if( !"Direct buffer memory".equals(oome.getMessage()) ) throw oome;
System.out.println("Sleeping & retrying");
try { Thread.sleep(100); } catch( InterruptedException ignore ) { }
}
}
}
private static void bbFree(ByteBuffer bb) {
代码示例来源:origin: apache/hbase
@Override
public CallRunner poll() {
CallRunner cr;
boolean switched = false;
while(true) {
if (((double) queue.size() / this.maxCapacity) > lifoThreshold) {
// Only count once per switch.
if (!switched) {
switched = true;
numLifoModeSwitches.increment();
}
cr = queue.pollLast();
} else {
switched = false;
cr = queue.pollFirst();
}
if (cr == null) {
return cr;
}
if (needToDrop(cr)) {
numGeneralCallsDropped.increment();
cr.drop();
} else {
return cr;
}
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
/**
* Iterates over snapshot to capture all Avg metrics into rolling structure
* {@link MutableRollingAverages#averages}.
*/
private synchronized void rollOverAvgs() {
if (currentSnapshot == null) {
return;
}
for (Map.Entry<String, MutableRate> entry : currentSnapshot.entrySet()) {
final MutableRate rate = entry.getValue();
final LinkedBlockingDeque<SumAndCount> deque = averages.computeIfAbsent(
entry.getKey(),
new Function<String, LinkedBlockingDeque<SumAndCount>>() {
@Override
public LinkedBlockingDeque<SumAndCount> apply(String k) {
return new LinkedBlockingDeque<>(numWindows);
}
});
final SumAndCount sumAndCount = new SumAndCount(
rate.lastStat().total(),
rate.lastStat().numSamples());
/* put newest sum and count to the end */
if (!deque.offerLast(sumAndCount)) {
deque.pollFirst();
deque.offerLast(sumAndCount);
}
}
setChanged();
}
代码示例来源:origin: camunda/camunda-bpm-platform
queue.pollFirst();
break;
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
return pollFirst(timeout, unit);
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E removeFirst() {
E x = pollFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E removeFirst() {
E x = pollFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: MobiVM/robovm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E removeFirst() {
E x = pollFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: ibinti/bugvm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E removeFirst() {
E x = pollFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E removeFirst() {
E x = pollFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E removeFirst() {
E x = pollFirst();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: com.github.endoscope/endoscope-core
void processAllFromQueue(){
Context ctx = queue.pollFirst();
synchronized(stats){
while(ctx != null){
stats.store(ctx);
ctx = queue.pollFirst();
}
}
}
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
/**
* Waits for a completion and then marks it as complete.
* @throws InterruptedException
*/
private void waitForCompletions(long timeoutMs) throws InterruptedException {
Long completedOperation =
this.completedOperationIds.pollFirst(timeoutMs, TimeUnit.MILLISECONDS);
if (completedOperation != null) {
markOperationComplete(completedOperation);
}
}
代码示例来源:origin: com.github.tntim96/rhino
private DocumentBuilder getDocumentBuilderFromPool()
throws ParserConfigurationException {
DocumentBuilder builder = documentBuilderPool.pollFirst();
if (builder == null){
builder = getDomFactory().newDocumentBuilder();
}
builder.setErrorHandler(errorHandler);
return builder;
}
内容来源于网络,如有侵权,请联系作者删除!