本文整理了Java中java.util.concurrent.LinkedBlockingDeque.peekLast()
方法的一些代码示例,展示了LinkedBlockingDeque.peekLast()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedBlockingDeque.peekLast()
方法的具体详情如下:
包路径:java.util.concurrent.LinkedBlockingDeque
类名称:LinkedBlockingDeque
方法名:peekLast
暂无
代码示例来源:origin: robovm/robovm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getLast() {
E x = peekLast();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: prestodb/presto
public ExchangeClientStatus getStatus()
{
// The stats created by this method is only for diagnostics.
// It does not guarantee a consistent view between different exchange clients.
// Guaranteeing a consistent view introduces significant lock contention.
ImmutableList.Builder<PageBufferClientStatus> pageBufferClientStatusBuilder = ImmutableList.builder();
for (HttpPageBufferClient client : allClients.values()) {
pageBufferClientStatusBuilder.add(client.getStatus());
}
List<PageBufferClientStatus> pageBufferClientStatus = pageBufferClientStatusBuilder.build();
synchronized (this) {
int bufferedPages = pageBuffer.size();
if (bufferedPages > 0 && pageBuffer.peekLast() == NO_MORE_PAGES) {
bufferedPages--;
}
return new ExchangeClientStatus(bufferRetainedSizeInBytes, maxBufferRetainedSizeInBytes, averageBytesPerRequest, successfulRequests, bufferedPages, noMoreLocations, pageBufferClientStatus);
}
}
代码示例来源:origin: prestodb/presto
@Override
public synchronized void close()
{
if (!closed.compareAndSet(false, true)) {
return;
}
for (HttpPageBufferClient client : allClients.values()) {
closeQuietly(client);
}
pageBuffer.clear();
systemMemoryContext.setBytes(0);
bufferRetainedSizeInBytes = 0;
if (pageBuffer.peekLast() != NO_MORE_PAGES) {
checkState(pageBuffer.add(NO_MORE_PAGES), "Could not add no more pages marker");
}
notifyBlockedCallers();
}
代码示例来源:origin: azkaban/azkaban
/**
* Ingest metric in snapshot data structure while maintaining interval {@inheritDoc}
*
* @see azkaban.metric.IMetricEmitter#reportMetric(azkaban.metric.IMetric)
*/
@Override
public void reportMetric(final IMetric<?> metric) throws MetricException {
final String metricName = metric.getName();
if (!this.historyListMapping.containsKey(metricName)) {
logger.info("First time capturing metric: " + metricName);
this.historyListMapping.put(metricName, new LinkedBlockingDeque<>());
}
synchronized (this.historyListMapping.get(metricName)) {
logger.debug("Ingesting metric: " + metricName);
this.historyListMapping.get(metricName).add(new InMemoryHistoryNode(metric.getValue()));
cleanUsingTime(metricName, this.historyListMapping.get(metricName).peekLast().getTimestamp());
}
}
代码示例来源:origin: prestodb/presto
if (pageBuffer.peekLast() != NO_MORE_PAGES) {
checkState(pageBuffer.add(NO_MORE_PAGES), "Could not add no more pages marker");
代码示例来源:origin: jankotek/mapdb
/**
* Returns a new deque of given size containing consecutive
* Integers 0 ... n - 1.
*/
private static LinkedBlockingDeque<Integer> populatedDeque(int n) {
LinkedBlockingDeque<Integer> q =
new LinkedBlockingDeque<Integer>(n);
assertTrue(q.isEmpty());
for (int i = 0; i < n; i++)
assertTrue(q.offer(new Integer(i)));
assertFalse(q.isEmpty());
assertEquals(0, q.remainingCapacity());
assertEquals(n, q.size());
assertEquals((Integer) 0, q.peekFirst());
assertEquals((Integer) (n - 1), q.peekLast());
return q;
}
代码示例来源:origin: numenta/htm.java
/**
* Retrieves, but does not remove, the last element of this deque, or
* returns null if this deque is empty.
*
* @return
*/
public E peekLast() {
return backingList.peekLast();
}
代码示例来源:origin: jtulach/bck2brwsr
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getLast() {
E x = peekLast();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: MobiVM/robovm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getLast() {
E x = peekLast();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: ibinti/bugvm
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getLast() {
E x = peekLast();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getLast() {
E x = peekLast();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getLast() {
E x = peekLast();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E getLast() {
E x = peekLast();
if (x == null) throw new NoSuchElementException();
return x;
}
代码示例来源:origin: org.apache.apex/malhar-library
/**
* Operations that need to be done once a scan is complete.
*/
protected void scanComplete()
{
LOG.debug("scan complete {}", lastScanMillis);
FileInfo fileInfo = discoveredFiles.peekLast();
if (fileInfo != null) {
fileInfo.lastFileOfScan = true;
}
lastScanMillis = System.currentTimeMillis();
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
public synchronized ExchangeClientStatus getStatus()
{
int bufferedPages = pageBuffer.size();
if (bufferedPages > 0 && pageBuffer.peekLast() == NO_MORE_PAGES) {
bufferedPages--;
}
ImmutableList.Builder<PageBufferClientStatus> exchangeStatus = ImmutableList.builder();
for (HttpPageBufferClient client : allClients.values()) {
exchangeStatus.add(client.getStatus());
}
return new ExchangeClientStatus(bufferBytes, averageBytesPerRequest, bufferedPages, noMoreLocations, exchangeStatus.build());
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
private ByteBufferHolder getByteBufferHolder(int capacity) {
ByteBufferHolder holder = buffers.peekLast();
if (holder == null || holder.isFlipped() || holder.getBuf().remaining() < capacity) {
ByteBuffer buffer = ByteBuffer.allocate(Math.max(bufferSize, capacity));
holder = new ByteBufferHolder(buffer, false);
buffers.add(holder);
}
return holder;
}
代码示例来源:origin: codefollower/Tomcat-Research
private void addToBuffers(byte[] buf, int offset, int length) {
ByteBufferHolder holder = bufferedWrites.peekLast();
if (holder==null || holder.isFlipped() || holder.getBuf().remaining()<length) {
ByteBuffer buffer = ByteBuffer.allocate(Math.max(bufferedWriteSize,length));
holder = new ByteBufferHolder(buffer,false);
bufferedWrites.add(holder);
}
holder.getBuf().put(buf,offset,length);
}
代码示例来源:origin: codefollower/Tomcat-Research
private void addToBuffers(byte[] buf, int offset, int length) {
ByteBufferHolder holder = bufferedWrites.peekLast();
if (holder == null || holder.isFlipped() || holder.getBuf().remaining() < length) {
ByteBuffer buffer = ByteBuffer.allocate(Math.max(bufferedWriteSize,length));
holder = new ByteBufferHolder(buffer, false);
bufferedWrites.add(holder);
}
holder.getBuf().put(buf, offset, length);
}
代码示例来源:origin: codefollower/Tomcat-Research
private void addToBuffers(byte[] buf, int offset, int length) {
ByteBufferHolder holder = bufferedWrites.peekLast();
if (holder==null || holder.isFlipped() || holder.getBuf().remaining()<length) {
ByteBuffer buffer = ByteBuffer.allocate(Math.max(bufferedWriteSize,length));
holder = new ByteBufferHolder(buffer,false);
bufferedWrites.add(holder);
}
holder.getBuf().put(buf,offset,length);
}
代码示例来源:origin: uk.co.nichesolutions.presto/presto-main
@Override
public synchronized void close()
{
closed.set(true);
for (HttpPageBufferClient client : allClients.values()) {
closeQuietly(client);
}
pageBuffer.clear();
systemMemoryUsageListener.updateSystemMemoryUsage(-bufferBytes);
bufferBytes = 0;
if (pageBuffer.peekLast() != NO_MORE_PAGES) {
checkState(pageBuffer.add(NO_MORE_PAGES), "Could not add no more pages marker");
}
notifyBlockedCallers();
}
内容来源于网络,如有侵权,请联系作者删除!