Hi!

I was reading the Comet API documentation, that is "aio.html" in the
docs and Javadoc of catalina.comet.* classes.

Here are several notes.


CometEvent.java:
===============
- #setTimeout():
 a) @param timeout says it is positive value.

With recent Mark's fixes to timeout handling it also accepts "-1" as
the infinite timeout. It works great with Nio.
(I'll add setting -1 timeout to ChatServlet.).

With Http11AprProtocol you cannot set timeout: the method throws
java.lang.UnsupportedOperationException.

I think the value of "0" shall still be undocumented (I do not know
what it will do and it does not seem to be useful), so just "-1" can
be added.

b) Javadoc here says:
    "The
     web application SHOULD NOT attempt to reuse the request and
response objects after a timeout
     as the <code>error(HttpServletRequest,
HttpServletResponse)</code> method indicates."

It contradicts with description of EventSubType TIMEOUT here and in
aio.html, that says that this event is not fatal and
"the connection will not be closed unless the servlet uses the close
method of the event".

c) I am not sure whether setTimeout() can be called in READ event. The
Javadoc here says just that it cannot be called outside of events
("asynchronously"), but aio.html explicitly mentions that BEGIN event
should be used to call setTimeout().

d) In "Comet timeouts" section in aio.html it is said that the default
timeout for "soTimeout" for Nio and "soTimeout*50" for Apr. I have not
looked where it is actually set in the code,  but in HTTP Connector
documentation there is not attribute "soTimeout"

- #close():
a) "The servlet should perform any needed cleanup as if it had
received an END or ERROR event."

Does it need to perform the cleanup?

The description of EventType.READ event here and in aio.html also
mentions to perform cleanup before calling cose().

>From description of SESSION_END subtype of END event my understanding
would be that
it would receive it (maybe unless it was called in END or ERROR
events) and could cleanup there.

So, what SESSION_END is for?

- (Javadoc for EventType, EventSubType has no <p>,<br> and thus will
be unreadable.)
- (In SESSION_END do s/session/Comet session/ and do the same
replacement in aio.html, to avoid ambiguity).

CometProcessor
================
a) ("When this interface is implemented, the service method of the servlet will
 never be called".

-Actually the service() method will be called - It is called if the
connector does not support Comet,
as ChatServlet example shows. The same applies to CometFilter as well
).

aio.html
==========
a) Is CometEvent object available only as an argument of the event() method?

Can it be stored by cometprocessor between the events that it receives?
Or only HttpServletResponse and HttpServletRequest can be stored and
reused between events?

Thus, can a servlet call the CometEvent.close() method while it is
between events?

b) Can CometProcessor#event() be called for several events for the same
request&response pair at the same time? I guess that it cannot happen.

c) It is said "At any time, the servlet may end processing of the
request by using the close method of the event object."

Nothing is said about such methods of Servlet API as
OutputStream.close(), InputStream.close().
I guess they should result in receiving an END event, and in the END
event the sevlet will call CometEvent.close() to stop Comet
processing.

d) It is good to know that many Response methods will throw
IllegalStateException as aio.html clearly says that the response is
committed after BEGIN event.

What if we never called flush() on the output stream? Is it still "committed"?

If it is committed only "after BEGIN event",
can the servlet or filter call response.sendError() while it is in BEGIN event?

e) If a Connector is stopped, will it be SERVER_SHUTDOWN subtype of END event.
Though I think that during shutdown maybe WEBAPP_RELOAD will come first?
Will the event come if connector is stopped through JMX?
When a web application is stopped will it be WEBAPP_RELOAD?

Can these events come asynchronously with regards to other
BEGIN/READ/END/ERROR events for the same request&response pair?


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to