How to use Async-IO
(setWriteListener) of Servlet3.1
with Spring-5 ?
Also, I found Link-A which mentions one needs to add Listener to outputStream.
On other hand Link-B says it should work with spring 5
and tomcat 8.5+
.
Next I profiled a JVM and found that CoyoteOutputStream.checkNonBlockingWrite
always return false
with both deferredResult
and NON-DeferredResult
sample code.
//MY TEST CODE
@GetMapping("/health")
public DeferredResult<DummyDTO> upNRuning(){
DeferredResult<DummyDTO> defferedResult = new DeferredResult<>();
newCachedThreadPool.submit(() ->
defferedResult.setResult(new DummyDTO()));
return defferedResult;
}
I was not able to try Link-A
recommandation as i am not sure of NioReadListener
implementation and its arguments.
PS:
Environment Spring-boot-2.0.4.RELEASE + Windows