Single threading a task without queuing further requests
I have a requirement for a task to be executed asynchronously while discarding any further requests until the task is finished. Synchronizing the method just queues up the tasks and doesn't skip. I initially thought to use a SingleThreadExecutor but that queues up tasks as well. I then looked at the ThreadPoolExecutor but it reads the queue to get the task to be executed and therefore will have one task executing and a minimum of one task queued (the others can be discarded using ThreadPoolExecutor.DiscardPolicy). The only thing I can think off is to use a Semaphore to block the queue. I've