List of usage examples for javax.servlet ReadListener onDataAvailable
public void onDataAvailable() throws IOException;
ReadListener
is registered with a ServletInputStream , this method will be invoked by the container the first time when it is possible to read data. From source file:com.kolich.curacao.examples.controllers.NonBlockingIOExampleController.java
@PUT("/api/nonblocking") public final void nonblocking(final AsyncContext context, final HttpServletRequest request, final HttpServletResponse response, final ServletInputStream input, final ServletOutputStream output) throws Exception { final Queue<Option<String>> queue = new ConcurrentLinkedQueue<Option<String>>(); final WriteListener writer = new StupidWriteListener(context, queue, output); final ReadListener reader = new StupidReadListener(queue, input, output, writer, request.getContentLength()); // Producer/*from w w w.java2 s . c om*/ input.setReadListener(reader); logger__.info("Tomcat, is input ready?: " + input.isReady()); reader.onDataAvailable(); // Consumer output.setWriteListener(writer); logger__.info("Tomcat, is input ready?: " + output.isReady()); writer.onWritePossible(); }