BQ is a Q whose put method blocks if the Q has reached its maximum
capacity and its get method blocks if the Q is already empty.
from normal synchronized put method, BQ also supports blocking of
threads if they try to read the Q when empty or try to write to the Q
when its full.
has following flavors:
Same as #1 except that it accepts objects implementing Delayed
only. Delayed mandates implementation of getDelay(TimeUnit)
which should return the remaining delay associated with this object.
So every object in DelayQueue is available only after the delay
specified with that object has passed.
This is a BQ having capacity of only one element. Due to capacity of
one element only, it forces single production followed by single
This is same as BQ except that it offers function which can make a
producer wait for the consumer to consume it. This is done by adding
transfer(T obj) : blocks the producer till transfer happens
tryTransfer (T obj) : returns immediately indicating if the
transfer happened or not.
tryTransfer (T obj, long timeCount, TimeUnit unit) : same as above
but with a time-out.
Got a thought to share or found a bug in the code? We'd love to hear from you: