public void push(E e) { addFirst(e); } public E pop() { return removeFirst(); }
public void add(T value) { if (value.getPriority() > Priority.DEFAULT_PRIORITY) { _highPriority.addLast(value); } else { _lowPriority.addFirst(value); } }
/** {@inheritDoc} */ @Override public void addForRecycle(ReuseBag bag) throws IgniteCheckedException { long pageId; while ((pageId = bag.pollFreePage()) != 0L) deque.addFirst(pageId); }
public void checkContext(String s, boolean front) { if (!front && pendingContext.size() > MAX_PENDING) return; // queue is full if (!harvestedContext.contains(s) && !pendingContext.contains(s)) { if (front) pendingContext.addFirst(s); else pendingContext.addLast(s); } while (pendingContext.size() > MAX_PENDING) pendingContext.removeLast(); if (harvestedContext.size() > MAX_HARVESTED) harvestedContext.clear(); }
/** * Process all the responses for this connection * @return true if all the calls were processed or that someone else is doing it. false if there * * is still some work to do. In this case, we expect the caller to delay us. * @throws IOException */ private boolean processAllResponses(final SimpleServerRpcConnection connection) throws IOException { // We want only one writer on the channel for a connection at a time. connection.responseWriteLock.lock(); try { for (int i = 0; i < 20; i++) { // protection if some handlers manage to need all the responder RpcResponse resp = connection.responseQueue.pollFirst(); if (resp == null) { return true; } if (!processResponse(connection, resp)) { connection.responseQueue.addFirst(resp); return false; } } } finally { connection.responseWriteLock.unlock(); } return connection.responseQueue.isEmpty(); }
taskQueue.addFirst(Pair.of(future, task)); return future; } else {
void doRespond(SimpleServerRpcConnection conn, RpcResponse resp) throws IOException { boolean added = false; // If there is already a write in progress, we don't wait. This allows to free the handlers // immediately for other tasks. if (conn.responseQueue.isEmpty() && conn.responseWriteLock.tryLock()) { try { if (conn.responseQueue.isEmpty()) { // If we're alone, we can try to do a direct call to the socket. It's // an optimization to save on context switches and data transfer between cores.. if (processResponse(conn, resp)) { return; // we're done. } // Too big to fit, putting ahead. conn.responseQueue.addFirst(resp); added = true; // We will register to the selector later, outside of the lock. } } finally { conn.responseWriteLock.unlock(); } } if (!added) { conn.responseQueue.addLast(resp); } registerForWrite(conn); } }
} else if (sizeSummed > threshold) { toOffloadSize += size; toOffload.addFirst(e.getValue());
currentData.addFirst(data.get(i));
currentData.addFirst(new double[] { 0, 0 }); currentData.removeLast(); timestamps[s] = timestamps[s - 1] + 1; System.out.println(s + ":" + l[1] + l[2] + "=" + NeuroUtils.parseUnsignedHex(l[1] + l[2])); if (l.length == 5) currentData.addFirst(new double[] { -5000d + 10000d * NeuroUtils.parseUnsignedHex(l[1] + l[2]) / 16777216d, -5000d + 10000d * NeuroUtils.parseUnsignedHex(l[3] + l[4]) / 16777216d }); else // something else, or broken -> skip continue; } else currentData.addFirst(new double[] { Double.valueOf(l[1]), Double.valueOf(l[2]) });
private void deallocateSharerSet(long id, TShortHashSet sharers) { if (freeSharerSetList == null) return; freeSharerSetList.addFirst(sharers); }
private void deallocateCacheLine(long id, Cache.CacheLine line) { if (freeLineList == null) return; freeLineList.addFirst(line); }
public void push(E e) { addFirst(e); } public E pop() { return removeFirst(); }
public void push(E e) { addFirst(e); } public E pop() { return removeFirst(); }
public void push(E e) { addFirst(e); } public E pop() { return removeFirst(); }
public void push(E e) { addFirst(e); }
@Override public void addFirst(SourceRecord sourceRecord) { waitForCapacity(); super.addFirst(sourceRecord); }
public void add(T value) { if (value.getPriority() > Priority.DEFAULT_PRIORITY) { _highPriority.addLast(value); } else { _lowPriority.addFirst(value); } }
/** * adds components id in store along with their indexes * * @param components component that are added at start */ @Override public void add(final Component... components) { for (int i = components.length-1; i >=0; i--) { Component c = components[i]; getOrderedIds().addFirst(c.getId()); getIds().add(c.getId()); } }
/** * adds components id in store along with their indexes * * @param components component that are added at start */ @Override public void add(final Component... components) { for (int i = components.length-1; i >=0; i--) { Component c = components[i]; getOrderedIds().addFirst(c.getId()); getIds().add(c.getId()); } }