I'm on:
- OpenSuse 11.0
- java 1.6.0_07
- GlassfishV3-prelude-b26 (with integrated Grizzly 1.8.6)
- GWT 1.5.2 building upon example from
http://www.javascriptr.com/2008/05/28/gwt-grizzly-comet/
- dual core T8400 at 3GHz.
In essence I want to achieve long polling. My evaluation code writes a
string message after a delay of 5 seconds
using the following code:
public void onEvent(CometEvent cometEvent) throws IOException {
Message msg = (Message) cometEvent.attachment();
try {
String encoded =
RPC.encodeResponseForSuccess(CometServiceImpl.class.getMethod("comet"),
msg);
writeResponse(req, res, encoded);
cometContext.resumeCometHandler(this);
}
catch (Exception e) {
log("Exception in GWTCometHandler.onEvent: " + e);
e.printStackTrace();
}
}
From the browser client, I keep calling this code, by re-opening a
connection after having received an answer.
The code works, and glassfish is not blocking IO anymore even if I hit
the server with 10 browser instances. Great work
guys. But so now and then I get the error message below (even when I hit
my server form a single client), which makes
me believe that, although I only have a single notify() every 5 seconds,
sometimes more than once my onEvent gets called by
the Comet framework. This happens at irregular intervals, sometimes
after 30 seconds, sometimes after several minutes.
PS. I would be happy to evaluate Grizzly 1.8.6.1 to see if this issue is
already out of the way. Could somebody refer to some
documentation that will allow me to run 1.8.6.1 from within GlassfishV3,
since the obvious attempt of bluntly removing it's
grizzly-modules.jar and grizzly-optionals.jar files and adding in the
same directory the 1.8.6.1 jars doesn't work.
java.lang.IllegalStateException: PWC3990: getWriter() has already been
called for this response
at
org.apache.catalina.connector.Response.getOutputStream(Response.java:685)
at
org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:213)
at
com.google.gwt.user.server.rpc.RPCServletUtils.writeResponse(RPCServletUtils.java:234)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.writeResponse(RemoteServiceServlet.java:379)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:431)
at
org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:462)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:139)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
at
com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:142)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:307)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
at
com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:625)
at
com.sun.grizzly.comet.CometEngine.executeServlet(CometEngine.java:564)
at com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:318)
at
com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:84)
at
com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:130)
at
com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:109)
at
com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:88)
at com.sun.grizzly.http.TaskBase.call(TaskBase.java:359)
at
com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)