The asynchronous servlet feature enables you to process incoming requests and responses without being bound to the original thread that initiated the request.
AtomicBoolean isOkayToRun = (AtomicBoolean) request.getAttribute("isOkayToRun");
if (isOkayToRun.setAndGet(false)){
//do a dispatch
}
With this approach, only one thread
can obtain access to write to the response.