/** * Offer a {@link Channel} back to the internal storage. This will return {@code true} if the {@link Channel} * could be added, {@code false} otherwise. * * Sub-classes may override {@link #pollChannel()} and {@link #offerChannel(Channel)}. Be aware that * implementations of these methods needs to be thread-safe! */ protected boolean offerChannel(Channel channel) { return deque.offer(channel); }
public void testHoldsLockOnAllOperations() { create().element(); create().offer("foo"); create().peek(); create().poll();
/** * Offer a {@link Channel} back to the internal storage. This will return {@code true} if the {@link Channel} * could be added, {@code false} otherwise. * * Sub-classes may override {@link #pollChannel()} and {@link #offerChannel(Channel)}. Be aware that * implementations of these methods needs to be thread-safe! */ protected boolean offerChannel(Channel channel) { return deque.offer(channel); }
/** * Offer a {@link Channel} back to the internal storage. This will return {@code true} if the {@link Channel} * could be added, {@code false} otherwise. * * Sub-classes may override {@link #pollChannel()} and {@link #offerChannel(Channel)}. Be aware that * implementations of these methods needs to be thread-safe! */ protected boolean offerChannel(Channel channel) { return deque.offer(channel); }
@Override public synchronized boolean offer(V e) { return delegate.offer(e); }
public void enqueue(DeferredCall deferredCall) { deferDetected.set(true); deferredCalls.offer(deferredCall); }
/** {@inheritDoc} */ @Override public boolean offer(E e) { boolean res = deque.offer(e); if (res) adder.increment(); return res; }
/** * Add a new operation to the queue. * * @param operation the operation */ public void offer(Operation operation) { checkNotNull(operation); queue.offer(operation); }
private void flush() { if ( chunkCursor > 0 ) { synchronized ( chunks ) { Chunk<T> chunkToAdd = new Chunk<>( thresholdSupplier.get(), copyOf( chunk, chunkCursor ) ); chunks.offer( chunkToAdd ); } chunkCursor = 0; } }
@Override public boolean offer(E o) { assertTrue(Thread.holdsLock(mutex)); return delegate.offer(o); }
/** * Called from the producing code to offer data up ready for a subscriber to read it * * @param data the data to offer */ public void offer(T data) { mutex.execute(() -> dataQ.offer(data)); }
void releaseConnection(ImapConnection connection) { if (connection != null && connection.isConnected()) { synchronized (connections) { connections.offer(connection); } } }
private void enqueueFrameWithoutMerge(FlowControlled frame) { pendingWriteQueue.offer(frame); // This must be called after adding to the queue in order so that hasFrame() is // updated before updating the stream state. incrementPendingBytes(frame.size(), true); }
/** * It's a heavy init method. */ public void init() { for (int i = 0; i < poolSize; i++) { ByteBuffer byteBuffer = ByteBuffer.allocateDirect(fileSize); final long address = ((DirectBuffer) byteBuffer).address(); Pointer pointer = new Pointer(address); LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize)); availableBuffers.offer(byteBuffer); } }
/** {@inheritDoc} */ @Override public void onMessage(UUID nodeId, Message msg, IgniteRunnable msgC) { msgC.run(); if (msg instanceof GridTestMessage) { GridTestMessage testMsg = (GridTestMessage)msg; if (!testMsg.getSourceNodeId().equals(nodeId)) fail("Listener nodeId is not equal to message nodeId."); if (!reject) rcvdMsgs.offer(testMsg); if (!locNodeId.equals(nodeId)) rmtMsgCnt.incrementAndGet(); } }
/** {@inheritDoc} */ @Override public void onMessage(UUID nodeId, Message msg, IgniteRunnable msgC) { msgC.run(); if (msg instanceof GridTestMessage) { GridTestMessage testMsg = (GridTestMessage)msg; if (!testMsg.getSourceNodeId().equals(nodeId)) fail("Listener nodeId is not equal to message nodeId."); if (!reject) rcvdMsgs.offer(testMsg); if (!locNodeId.equals(nodeId)) rmtMsgCnt.incrementAndGet(); } else fail(); }
cachedNioBuffers.offer(nioBuffer);
cachedNioBuffers.offer(nioBuffer);
else if (connections.offer(conn)) { conn.setInPool(true); connsInPool.incrementAndGet();