In his blog. Peter Veentjer
describes some of the work that he is doing to extend the new concurrency library
. The blog expands on his implementation of a thread synchronization class he calls WaitPoint.
One of the things that annoyed me, while implementing this library, is that I had to reimplement waiting logic: making the ThreadPoolRepeater and ThreadPoolBlockingExecutor pausible for example. Finally it occurred to me, I needed a structure, threads can wait on: the WaitPoint. The WaitPoint is nothing more than a synchronization structure a Thread needs to pass to continue:
The idea, as Peter explains it, is to create synchronization points that can be open or closed. Open wait points allow threads to pass through, where as closed, will force thread to wait until the synchronization point is opened.
Using this new class, he goes on to describe an implementation of a BlockingQueue where you can have much finer control over the flow through the queue.
all puts go through a front-waitpoint and all takes go through a back-waitpoint
This design allows one to stop thread from performing puts or takes. So one can either clear a queue or stop execution. In a follow on thought, Peter is thinking about how this technique could be used to regulate capacity.