Re: Comet changes

2007-05-10 Thread Filip Hanik - Dev Lists
ok, changes are in, there is one inconsistency, currently READ is a main type, while WRITE is a subtype of NOTIFY thoughts on consolidate these? ie NOTIFY/READ or make WRITE a main type by no means is this set in stone, and as we go along and discover problems or semantics issues, we can make a

Re: Comet changes

2007-05-10 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: 1. CometEvent.notify is a servlet calling container method,not a callback from the container The servlet calls the "notify" method, right ? 2. Introduce a new EventType -> NOTIFY 3. Keep the sub event type -> WRITE_COMPLETE, instead of hav

Re: Comet changes

2007-05-09 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: 1. CometEvent.notify is a servlet calling container method,not a callback from the container The servlet calls the "notify" method, right ? 2. Introduce a new EventType -> NOTIFY 3. Keep the sub event type -> WRITE_COMPLETE, instead of having to busy poll Comet

Re: Comet changes

2007-05-09 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: oh crap, we are thinking way different :), I was thinking the other way around Here is one event chain 1. CometProcessor.event(CometEvent.BEGIN/null) 2. Servlet calls CometEvent.setBlocking(false); 3. Servlet calls CometEvent.notify(READ) -

Re: Comet changes

2007-05-09 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: oh crap, we are thinking way different :), I was thinking the other way around Here is one event chain 1. CometProcessor.event(CometEvent.BEGIN/null) 2. Servlet calls CometEvent.setBlocking(false); 3. Servlet calls CometEvent.notify(READ) -

Re: Comet changes

2007-05-09 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: oh crap, we are thinking way different :), I was thinking the other way around Here is one event chain 1. CometProcessor.event(CometEvent.BEGIN/null) 2. Servlet calls CometEvent.setBlocking(false); 3. Servlet calls CometEvent.notify(READ) - the servlet wants to be

Re: Comet changes

2007-05-09 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: true. lets see how it pans out in actual code, that might change our perspective. I was toying around with an alternative idea too, disallow any read or write all together unless it is done on a worker thread. gives us complete control, ea

Re: Comet changes

2007-05-09 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: true. lets see how it pans out in actual code, that might change our perspective. I was toying around with an alternative idea too, disallow any read or write all together unless it is done on a worker thread. gives us complete control, easier to implement. pu

Re: Comet changes

2007-05-09 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: So it uses a poller automatically, and the WRITE event would be sent when the socket is signaled by the poller, then. This is very similar. The only problem is that it could cause sync is

Re: Comet changes

2007-05-09 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: So it uses a poller automatically, and the WRITE event would be sent when the socket is signaled by the poller, then. This is very similar. The only problem is that it could cause sync issues, since the servlet

Re: Comet changes

2007-05-09 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: I agree, but I don't understand how you can know if you can write without a write polling. If there are no events on read, I have the impression writing could be suspended for an indefini

Re: Comet changes

2007-05-09 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: I agree, but I don't understand how you can know if you can write without a write polling. If there are no events on read, I have the impression writing could be suspended for an indefinite amount of time. So

Re: Comet changes

2007-05-08 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: Here are some changes. 1. The background thread should not have to call notifyWrite, since we provide READ event, we can also provide an automatic event is thrown when a write completes EventType=NOTIFY EventSubType=WRITE_COMPLETE, as soon

Re: Comet changes

2007-05-08 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: Here are some changes. 1. The background thread should not have to call notifyWrite, since we provide READ event, we can also provide an automatic event is thrown when a write completes EventType=NOTIFY EventSubType=WRITE_COMPLETE, as soon as the write does comp

Re: Comet changes

2007-05-08 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: That doesn't look like much of a problem to me. The user in that case would be writing in a situation where canWrite is false (since the data hasn't been written yet), which is an error.

Re: Comet changes

2007-05-08 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: That doesn't look like much of a problem to me. The user in that case would be writing in a situation where canWrite is false (since the data hasn't been written yet), which is an error. To resume writing stuf

Re: Comet changes

2007-05-08 Thread Remy Maucherat
(repost, trouble with smtp) Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: That doesn't look like much of a problem to me. The user in that case would be writing in a situation where canWrite is false (since the data hasn't been written yet), which is an e

Re: Comet changes

2007-05-08 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: That's the easy part: the bytes are kept in the usual socket buffer, which will be flushed when the connection comes back from the write poller, just before invoking the write event. not so easy, if the servlet invokes

Re: Comet changes

2007-05-08 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: That's the easy part: the bytes are kept in the usual socket buffer, which will be flushed when the connection comes back from the write poller, just before invoking the write event. not so easy, if the servlet invokes write again, you have c

Re: Comet changes

2007-05-08 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: I thought about the canWrite idea earlier, and there is a difficult problem to get around. the steps are 1. canWrite - returns true 2. response.getOutputStream().write(8k byte array) 3. only 2k gets written during the non blocking write so w

Re: Comet changes

2007-05-08 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: I'm on GMT+1 time for the next 5 weeks. Jean-Frédéric told me you were in Finland. Close :), actually in Sweden, my country of origination. Filip Rémy - To unsubscribe,

Re: Comet changes

2007-05-07 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: I'm on GMT+1 time for the next 5 weeks. Jean-Frédéric told me you were in Finland. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Comet changes

2007-05-07 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: I thought about the canWrite idea earlier, and there is a difficult problem to get around. the steps are 1. canWrite - returns true 2. response.getOutputStream().write(8k byte array) 3. only 2k gets written during the non blocking write so what does one do? does i

Re: Comet changes

2007-05-07 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: ok, here we go, I have thought about this and have two different proposals. 1. Add non blocking support to Coyote(In|Out)putStream The servlet can cast request.getInputStream() to a CoyoteInputStream Example: //perform a non blocking r

Re: Comet changes

2007-05-07 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: ok, here we go, I have thought about this and have two different proposals. 1. Add non blocking support to Coyote(In|Out)putStream The servlet can cast request.getInputStream() to a CoyoteInputStream Example: //perform a non blocking read. int read = ((Coyo

Re: Comet changes

2007-05-07 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: - EOF as a new ComentEvent.EventSubType, subtype of CometEvent.EventType .END (will be called when the endpoint signals a read); after getting this event, the CometAdapter could automagically call CometEvent.disableReadPolling() to avoid pro

Re: Comet changes

2007-05-07 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: - EOF as a new ComentEvent.EventSubType, subtype of CometEvent.EventType .END (will be called when the endpoint signals a read); after getting this event, the CometAdapter could automagically call CometEvent.disableReadPolling() to avoid problems if the client so

Re: Comet changes

2007-05-07 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Hi, To summarize, I propose the following additions in the Comet functionality for the next Tomcat 6.0 release (the various names are proposals, I am not very good at names): - per event timeout becomes mandatory per event or per connection? - small refactoring of the t

Re: Comet changes

2007-05-06 Thread Yoav Shapira
Hi, Overall I haven't been very involved with Comet, and only used it in testing / playing around, not in production. But that said, your proposed changes make good sense to me. On 5/6/07, Remy Maucherat <[EMAIL PROTECTED]> wrote: To summarize, I propose the following additions in the Comet fun

Comet changes

2007-05-06 Thread Remy Maucherat
Hi, To summarize, I propose the following additions in the Comet functionality for the next Tomcat 6.0 release (the various names are proposals, I am not very good at names): - per event timeout becomes mandatory - small refactoring of the timeout callback using an action code rather than a r

Re: Proposal - Comet changes

2006-09-13 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: For some of these events, we could provide with Tomcat a set of utility valves which would implement them, such as a connection tracking valve (closes connections on reloads or when sessions expire). agreed got my hands full today, will sleep on it some more. I

Re: Proposal - Comet changes

2006-09-13 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: That's a second step :) It's a good idea because at the moment there's only a boolean, so it's not possible to do anything except sending an ERROR or READ event. Right now, I'm doing all the changes in the servlet con

Re: Proposal - Comet changes

2006-09-13 Thread Remy Maucherat
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: That's a second step :) It's a good idea because at the moment there's only a boolean, so it's not possible to do anything except sending an ERROR or READ event. Right now, I'm doing all the changes in the servlet container (which is enoug

Re: Proposal - Comet changes

2006-09-12 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: great, can we adjust processSocket(socket, boolean) (AprEndPoint and NioEndpoint) so that it can pass the correct data (timeout, shutdown etc) I can do all the schtuff in the NIO piece, its so similar to the APR piece that I can just see what you have done there.

Re: Proposal - Comet changes

2006-09-11 Thread Filip Hanik - Dev Lists
great, can we adjust processSocket(socket, boolean) (AprEndPoint and NioEndpoint) so that it can pass the correct data (timeout, shutdown etc) I can do all the schtuff in the NIO piece, its so similar to the APR piece that I can just see what you have done there. Filip Remy Maucherat wrote:

Re: Proposal - Comet changes

2006-09-11 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: yes please get started, I want to spend some time in the clustering code right now, so I'll chime in a bit later. Cool. Since I'll be reusing a lot of existing code, I think it'll be done quickly (maybe by tomorrow). Rémy --

Re: Proposal - Comet changes

2006-09-08 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: head is clearing up...how about... since: public class MyServlet implements HttpServlet, o.a.c.CometProcessor { wouldn't it make sense for: public class MyFilter implements Filter, o.a.c.CometFilter { and you'd declare it the sam

Re: Proposal - Comet changes

2006-09-08 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: head is clearing up...how about... since: public class MyServlet implements HttpServlet, o.a.c.CometProcessor { wouldn't it make sense for: public class MyFilter implements Filter, o.a.c.CometFilter { and you'd declare it the same way, since we are piggy

Re: Proposal - Comet changes

2006-09-08 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: No, I don't see how filters can work. It is possible that some filters which would be wrapping the request would be ok, but most likely they would do something when the call returns (and finish what they had to do), so any attempt to use the

Re: Proposal - Comet changes

2006-09-08 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: No, I don't see how filters can work. It is possible that some filters which would be wrapping the request would be ok, but most likely they would do something when the call returns (and finish what they had to do), so any attempt to use the wrapped objects would

Re: Proposal - Comet changes

2006-09-07 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: ok, I've had a chance to think about it, and let me try to summarize our ideas, my goal here is to simplify the implementation I agree to a significant extent, but I would like to go a bit further and clean things up for interception. 1.

Re: Proposal - Comet changes

2006-09-07 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: ok, I've had a chance to think about it, and let me try to summarize our ideas, my goal here is to simplify the implementation I agree to a significant extent, but I would like to go a bit further and clean things up for interception. 1. CometEvent would be an

Re: Proposal - Comet changes

2006-09-07 Thread Filip Hanik - Dev Lists
ok, I've had a chance to think about it, and let me try to summarize our ideas, my goal here is to simplify the implementation 1. CometEvent would be an interface, in such a way that we could reuse the objects in the backend, and also provide a facade to hide server details from the servlet

Re: Proposal - Comet changes

2006-08-19 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: my proposal is a little delayed, had a slight Fedora Core meltdown, still recovering I thought about it a bit, and I think we could do the following (with an event method): - If the "servlet" implements CometProcessor and the connector supports Comet, then don't

Re: Proposal - Comet changes

2006-08-18 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: my proposal is a little delayed, had a slight Fedora Core meltdown, still recovering Soon, you're going to say it's all my fault. that's implicit :) I am away without email next week, and I'm coming back on friday (in the evening). enj

Re: Proposal - Comet changes

2006-08-18 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: my proposal is a little delayed, had a slight Fedora Core meltdown, still recovering Soon, you're going to say it's all my fault. I am away without email next week, and I'm coming back on friday (in the evening). Rémy -

Re: Proposal - Comet changes

2006-08-18 Thread Filip Hanik - Dev Lists
my proposal is a little delayed, had a slight Fedora Core meltdown, still recovering Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: what am I thinking, all connectors, so far only the connectors supporting poll are valid candidates for comet :) I don't k

Re: Proposal - Comet changes

2006-08-17 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: what am I thinking, all connectors, so far only the connectors supporting poll are valid candidates for comet :) I don't know how to redo the advertisement part of comet support without the special "org.apache.tomcat.comet.support" attribut

Re: Proposal - Comet changes

2006-08-17 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: what am I thinking, all connectors, so far only the connectors supporting poll are valid candidates for comet :) I don't know how to redo the advertisement part of comet support without the special "org.apache.tomcat.comet.support" attribute, though. Rémy

Re: Proposal - Comet changes

2006-08-16 Thread Filip Hanik - Dev Lists
Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: flush I can see, but close in a comet I can't, there is no way to send additional data after close is called, as that is a output stream close method. calling close, will/should eventual

Re: Proposal - Comet changes

2006-08-16 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: flush I can see, but close in a comet I can't, there is no way to send additional data after close is called, as that is a output stream close method. calling close, will/should eventually trigger event(END). Ok, I w

Re: Proposal - Comet changes

2006-08-16 Thread Remy Maucherat
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: flush I can see, but close in a comet I can't, there is no way to send additional data after close is called, as that is a output stream close method. calling close, will/should eventually trigger event(END). Ok, I will make those changes.

Re: Proposal - Comet changes

2006-08-16 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: flush I can see, but close in a comet I can't, there is no way to send additional data after close is called, as that is a output stream close method. calling close, will/should eventually trigger event(END). Ok, I will make those changes. Rémy ---

Re: Proposal - Comet changes

2006-08-16 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: 5. CometEvent public class CometEvent { public enum EventType { READ,TIMEOUT,SOCKET_CLOSE,CONTAINER_SHUTDOWN,CONTEXT_SHUTDOWN,GENERIC_ERROR //and anything else, we could also crea

Re: Proposal - Comet changes

2006-08-16 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: 5. CometEvent public class CometEvent { public enum EventType { READ,TIMEOUT,SOCKET_CLOSE,CONTAINER_SHUTDOWN,CONTEXT_SHUTDOWN,GENERIC_ERROR //and anything else, we could also create groups of types, RE

Re: Proposal - Comet changes

2006-08-16 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: 5. CometEvent public class CometEvent { public enum EventType { READ,TIMEOUT,SOCKET_CLOSE,CONTAINER_SHUTDOWN,CONTEXT_SHUTDOWN,GENERIC_ERROR //and anything else, we could also create groups of types, READ,ERROR,SHUTDOWN, with subtypes

Re: Proposal - Comet changes

2006-08-16 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: 5. CometEvent public class CometEvent { public enum EventType { READ,TIMEOUT,SOCKET_CLOSE,CONTAINER_SHUTDOWN,CONTEXT_SHUTDOWN,GENERIC_ERROR //and anything else, we could also create groups of types, READ,ERROR,SHUTDOWN, with subtypes } public HttpSer

Re: Proposal - Comet changes

2006-08-15 Thread Sriram Narayanan
On 8/11/06, Filip Hanik - Dev Lists <[EMAIL PROTECTED]> wrote: 3. public boolean read(HttpServletRequest request, HttpServletResponse response) Suggestion - change this method to public boolean event(CometEvent event) This will allow the container to implement notifications for timeouts, s

Re: Proposal - Comet changes

2006-08-15 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: any feedback? If you're talking about me, I'm on vacation, so ... Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Proposal - Comet changes

2006-08-14 Thread Filip Hanik - Dev Lists
any feedback? Filip Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: I believe this would allow for more flexibility in the future and a cleaner interface. This doesn't look bad, although I don't have time to really think about it right now. Rémy ---

Re: Proposal - Comet changes

2006-08-11 Thread Filip Hanik - Dev Lists
Remy Maucherat wrote: Filip Hanik - Dev Lists wrote: I believe this would allow for more flexibility in the future and a cleaner interface. This doesn't look bad, although I don't have time to really think about it right now. no rush, instead enjoy your weekend, and we can elaborate next wee

Re: Proposal - Comet changes

2006-08-11 Thread Remy Maucherat
Filip Hanik - Dev Lists wrote: I believe this would allow for more flexibility in the future and a cleaner interface. This doesn't look bad, although I don't have time to really think about it right now. Rémy - To unsubscr

Proposal - Comet changes

2006-08-11 Thread Filip Hanik - Dev Lists
Gents, I have a suggestion on a small refactor for the CometProcessor, mainly to make it a little bit more flexible, here are my suggestions 1. public void begin(HttpServletRequest request, HttpServletResponse response) Suggestion - remove this method, its never called from the container anyw