ConcurrentBlockingRequestQueue

A simple array-based queue that uses synchronization to handle concurrent access to the data. The queue is blocked when requests are added, and when they're removed. It's not the best performance, but it just works.

Constructors

this
this(size_t queueSize)

Constructs the queue with the given size.

Members

Functions

dequeue
Socket dequeue()

Attempts to remove the next available socket from the queue, waiting for a pre-determined time, before timing out. If no socket becomes available, null may be returned.

enqueue
void enqueue(Socket s)

Adds a socket to the queue, using synchronization on this queue instance for thread-safety.

notify
void notify()

Manually notifies this queue's internal semaphore, which might be used to free up any threads that are waiting for a socket, usually used on shutdown.

Inherited Members

From RequestQueue

enqueue
void enqueue(Socket s)

Adds the given socket to the queue.

dequeue
Socket dequeue()

Attempts to remove a socket from the queue. This method may cause the calling thread to block for some amount of time until a socket is available to obtain.