I am using CometProcessor to implement long-polling on Tomcat 7.0. The thing that bothering me is I don't get any other events except CometEvent.EventType.BEGIN. The code sample:
@Override
public void event(CometEvent event) throws IOException, ServletException {
HttpServletRequest request = event.getHttpServletRequest();
HttpServletResponse response = event.getHttpServletResponse();
if (event.getEventType() == CometEvent.EventType.BEGIN) {
LOGGER.info("Begin for session: " + request.getSession(true).getId());
} else if (event.getEventType() == CometEvent.EventType.ERROR) {
LOGGER.error("Error for session: " + request.getSession(true).getId());
event.close();
} else if (event.getEventType() == CometEvent.EventType.END) {
LOGGER.info("End for session: " + request.getSession(true).getId());
event.close();
} else if (event.getEventType() == CometEvent.EventType.READ) {
LOGGER.info("Read from session: " + request.getSession(true).getId());
}
I assume it could cause memory leaks because on the BEGIN event I store the response object in my local array.
Does any one have any ideas what could be wrong?