import java.io.IOException; import java.io.PrintWriter; import java.util.Date; import java.util.Stack; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import weblogic.servlet.FutureResponseServlet; import weblogic.servlet.FutureServletResponse; // An AsynchronousServlet that handles HTTP requests from a "separate" thread and // not the execute thread used to invoke this servlet. public class AsynchronousServerResponseServlet extends FutureResponseServlet {
private final Notifier notifier;
public AsynchronousServerResponseServlet() { this.notifier = new Notifier(); this.notifier.start(); }
public void service(HttpServletRequest request, FutureServletResponse response) throws IOException,ServletException { // push this client's request to a buffer and return immediately. // asynchronous processing occurs in the run method of the Notifier Thread notifier.poll(request, response); }