Java executor with no ability to queue tasks
问题 I need an Java executor that rejects tasks if some other task is processing. I guess it's not possible to get manipulating the working queue size. Someone might wonder why I need an executor with such characteristic in the first place. I need an ability to easily change the policy and allow non-zero queue size. Any ideas? 回答1: Use a ThreadPoolExecutor with a SynchronousQueue (copied from this answer). It appears to work: import java.util.concurrent.RejectedExecutionHandler; import java.util