Package adaptlil.buffer
Class AsyncBuffer<T>
java.lang.Object
adaptlil.buffer.AsyncBuffer<T>
- Type Parameters:
T
-
Generically typed buffer that supports Asynchronous operations.
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
dataQueue
-
reentrantLock
-
-
Constructor Details
-
AsyncBuffer
public AsyncBuffer()
-
-
Method Details
-
write
Uses and entrant lock and blocks the main thread from writing until the lock is released- Parameters:
data
-
-
read
Blocks the main thread from reading until the lock is released.- Returns:
-
flush
public void flush()Flush the queue -
size
public int size() -
isEmpty
public boolean isEmpty()
-