...
These "maintenance" operations should be done in separate threads. The intention is to explore the parallelism as much as possible, so that buffer can perform all of them at the same time, and be able to respond to the requests coming from "outer world".
Realization
...
Buffer is realized in the way that every object that is to be inserted in the buffer is warped by IBufferElement. Buffer elements are connected in a queue, in the way that each buffer element knows what is the next buffer element in the queue.
Synchronization
The implementing class AtomicBuffer uses atomic values to enable the synchronization. For the suspending and activating the threads that work on "maintenance" operations, reentrant locks and their conditions are used.