The optional capacity bound constructor argument serves as a
way to prevent excessive queue expansion. The capacity, if unspecified,
is equal to Integer#MAX_VALUE. Linked nodes are
dynamically created upon each insertion unless this would bring the
queue above capacity.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| pack-priv static class | Queue.
Linked list node class |
| Modifier and Type | Field and Description |
|---|---|
| private static final RubyThread. | |
| protected volatile int | capacity
The capacity bound, or Integer.MAX_VALUE if none |
| protected volatile boolean | |
| protected final AtomicInteger | count
Current number of elements |
| pack-priv transient Queue. | head
Head of linked list. |
| protected transient Queue. | last
Tail of linked list. |
| protected final Condition | notEmpty
Wait queue for waiting takes |
| protected final Condition | notFull
Wait queue for waiting puts |
| protected final ReentrantLock | putLock
Lock held by put, offer, etc |
| protected final ReentrantLock | takeLock
Lock held by takeInternal, poll, etc |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | |
| public IRubyObject | |
| protected void | |
| public IRubyObject | |
| public IRubyObject | |
| protected void | |
| protected RaiseException | |
| protected IRubyObject | |
| public RubyBoolean | |
| protected void | |
| public final IRubyObject | |
| protected void | |
| protected void | |
| public IRubyObject | |
| public IRubyObject | |
| protected void | |
| protected void | |
| public boolean | |
| protected long | |
| public RubyNumeric | |
| public IRubyObject | |
| public RubyNumeric | |
| public IRubyObject | |
| public IRubyObject | |
| public IRubyObject | |
| public IRubyObject | |
| public IRubyObject | |
| private IRubyObject | |
| public IRubyObject | |
| protected void | putInternal(ThreadContext context, IRubyObject e)
Inserts the specified element at the tail of this queue, waiting if necessary for space to become available. |
| protected static long | |
| public IRubyObject | |
| public static RubyClass | |
| public static RubyClass | |
| public synchronized void | |
| protected void | |
| protected void | |
| protected IRubyObject |
| BLOCKING_TAKE_TASK | back to summary |
|---|---|
| private static final RubyThread. | |
| capacity | back to summary |
|---|---|
| protected volatile int capacity The capacity bound, or Integer.MAX_VALUE if none | |
| closed | back to summary |
|---|---|
| protected volatile boolean closed | |
| count | back to summary |
|---|---|
| protected final AtomicInteger count Current number of elements | |
| head | back to summary |
|---|---|
| pack-priv transient Queue. Head of linked list. Invariant: head.item == null | |
| last | back to summary |
|---|---|
| protected transient Queue. Tail of linked list. Invariant: last.next == null | |
| notEmpty | back to summary |
|---|---|
| protected final Condition notEmpty Wait queue for waiting takes | |
| notFull | back to summary |
|---|---|
| protected final Condition notFull Wait queue for waiting puts | |
| putLock | back to summary |
|---|---|
| protected final ReentrantLock putLock Lock held by put, offer, etc | |
| takeLock | back to summary |
|---|---|
| protected final ReentrantLock takeLock Lock held by takeInternal, poll, etc | |
| Queue | back to summary |
|---|---|
| public Queue(Ruby runtime, RubyClass type) | |
| checkShutdown | back to summary |
|---|---|
| public synchronized void checkShutdown()
Deprecated since 10.0.
| |
| clear | back to summary |
|---|---|
| public IRubyObject clear(ThreadContext context) Atomically removes all of the elements from this queue. The queue will be empty after this call returns.
| |
| clearInternal | back to summary |
|---|---|
| protected void clearInternal() throws InterruptedException | |
| close | back to summary |
|---|---|
public IRubyObject close(ThreadContext context)
| |
| closed_p | back to summary |
|---|---|
public IRubyObject closed_p(ThreadContext context)
| |
| closeInternal | back to summary |
|---|---|
| protected void closeInternal() throws InterruptedException | |
| createInterruptedError | back to summary |
|---|---|
| protected RaiseException createInterruptedError(ThreadContext context, String methodName) | |
| dequeue | back to summary |
|---|---|
| protected IRubyObject dequeue() | |
| empty_p | back to summary |
|---|---|
public RubyBoolean empty_p(ThreadContext context)
| |
| enqueue | back to summary |
|---|---|
| protected void enqueue(Queue. | |
| freeze | back to summary |
|---|---|
| public final IRubyObject freeze(ThreadContext context) Overrides org.
| |
| fullyLock | back to summary |
|---|---|
| protected void fullyLock() Locks to prevent both puts and takes. | |
| fullyUnlock | back to summary |
|---|---|
| protected void fullyUnlock() Unlocks to allow both puts and takes. | |
| initialize | back to summary |
|---|---|
| public IRubyObject initialize(ThreadContext context) Overrides org.
| |
| initialize | back to summary |
|---|---|
public IRubyObject initialize(ThreadContext context, IRubyObject items)
| |
| initializedCheck | back to summary |
|---|---|
| protected void initializedCheck()
Deprecated since 10.0.
| |
| initializedCheck | back to summary |
|---|---|
| protected void initializedCheck(ThreadContext context) | |
| isShutdown | back to summary |
|---|---|
| public boolean isShutdown() | |
| java_length | back to summary |
|---|---|
| protected long java_length() | |
| length | back to summary |
|---|---|
public RubyNumeric length(ThreadContext context)
| |
| marshal_dump | back to summary |
|---|---|
public IRubyObject marshal_dump(ThreadContext context)
| |
| num_waiting | back to summary |
|---|---|
public RubyNumeric num_waiting(ThreadContext context)
| |
| pollInternal | back to summary |
|---|---|
| public IRubyObject pollInternal() throws InterruptedException | |
| pollInternal | back to summary |
|---|---|
| public IRubyObject pollInternal(long timeout, TimeUnit unit) throws InterruptedException | |
| pop | back to summary |
|---|---|
public IRubyObject pop(ThreadContext context)
| |
| pop | back to summary |
|---|---|
public IRubyObject pop(ThreadContext context, IRubyObject nonblockOrOpts)
| |
| pop | back to summary |
|---|---|
public IRubyObject pop(ThreadContext context, IRubyObject _nonblock, IRubyObject _opts)
| |
| popCommon | back to summary |
|---|---|
| private IRubyObject popCommon(ThreadContext context, boolean nonblock, long timeoutNS) | |
| push | back to summary |
|---|---|
public IRubyObject push(ThreadContext context, IRubyObject value)
| |
| putInternal | back to summary |
|---|---|
| protected void putInternal(ThreadContext context, IRubyObject e) throws InterruptedException Inserts the specified element at the tail of this queue, waiting if necessary for space to become available.
| |
| queueTimeoutToNanos | back to summary |
|---|---|
| protected static long queueTimeoutToNanos(ThreadContext context, IRubyObject _timeout) | |
| raiseClosedError | back to summary |
|---|---|
| public IRubyObject raiseClosedError(ThreadContext context) | |
| setup | back to summary |
|---|---|
| public static RubyClass setup(ThreadContext context, RubyClass Thread, RubyClass Object) | |
| setupError | back to summary |
|---|---|
| public static RubyClass setupError(ThreadContext context, RubyClass Queue, RubyClass StopIteration, RubyClass Object) | |
| shutdown | back to summary |
|---|---|
| public synchronized void shutdown() throws InterruptedException | |
| signalNotEmpty | back to summary |
|---|---|
| protected void signalNotEmpty() Signals a waiting takeInternal. Called only from put/offer (which do not otherwise ordinarily lock takeLock.) | |
| signalNotFull | back to summary |
|---|---|
| protected void signalNotFull() Signals a waiting put. Called only from take/poll. | |
| takeInternal | back to summary |
|---|---|
| protected IRubyObject takeInternal(ThreadContext context) throws InterruptedException | |
| Modifier and Type | Field and Description |
|---|---|
| private final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public IRubyObject | |
| public void |
| timeoutNS | back to summary |
|---|---|
| private final long timeoutNS | |
| BlockingPollTask | back to summary |
|---|---|
| public BlockingPollTask(long timeoutNS) | |
| run | back to summary |
|---|---|
| public IRubyObject run(ThreadContext context, Queue queue) throws InterruptedException Implements org.
| |
| wakeup | back to summary |
|---|---|
| public void wakeup(RubyThread thread, Queue queue) Implements org.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv IRubyObject | |
| pack-priv Queue. | next
One of: - the real successor Node - this Node, meaning the successor is head.next - null, meaning there is no successor (this is the last node) |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| item | back to summary |
|---|---|
| pack-priv IRubyObject item | |
| next | back to summary |
|---|---|
| pack-priv Queue. One of: - the real successor Node - this Node, meaning the successor is head.next - null, meaning there is no successor (this is the last node) | |
| Node | back to summary |
|---|---|
| pack-priv Node(IRubyObject x) | |