>> Exception in thread "Thread-17" java.lang.NullPointerException
>>      at
>> org.apache.catalina.connector.CometEventImpl.close(CometEventImpl.java:84)
>>      at
>> com.mrtattle.tcniotest.CometServlet$Transport.close(CometServlet.java:42)
>>      at com.mrtattle.tcniotest.CometServlet$1.run(CometServlet.java:117)
>>      at java.lang.Thread.run(Thread.java:613)
>>   

>yes, calling "close" on the begin event, and then expecting the 
>CometEvent object to still function is a misuse of the API

I don't konw if it makes any difference, but: I am not calling close in the
begin event! My example never does so because I know that in this case the
io will never get in comet mode.

Obviously my pseudo code was misleading.

Step by step example (no keep alive)

1. Request Thread A triggers begin event. 
2. On the begin event a new Worker Thread is startet. That worker gets
access to the event object
3. Request Thread A leaves CometServlet.event method 
4. Worker Thread sends message 1
5. Another Request Thread B closes event

6. Request Thread C triggers end event. (because of no keep alive) -->
Recycling of req & res

>From that moment on event.close causes an NPE. In my example the Woker
Thread eventually tried to close the event again.

Same example (keep alive)

1-5. Same as above
6. Response is closed
7. Worker thread writes next messages to response (no exception)
8. Worker thread calls event.close() (no exception)
Wait a bit
9. Keep alive timeout -> END 

I know that you can just wrap the event object into some facade and keep
track of its state to prevent all this. It just whished it would behave it
bit different. And whishes are free right?


Filip Hanik - Dev Lists wrote:
> 
> Daniel Doubleday wrote:
>>>> I don't think that a event.close() call should throw a NPE when the
>>>> event
>>>>       
>> is
>>   
>>>> already closed. But I would rather catch an exception when I am writing
>>>> to
>>>> response object that has been closed.
>>>>       
>>>   
>>> that is possible to do, do you have the stack trace of the NPE?
>>>     
>>
>> Here is the stack trace:
>>
>> Exception in thread "Thread-17" java.lang.NullPointerException
>>      at
>> org.apache.catalina.connector.CometEventImpl.close(CometEventImpl.java:84)
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/comet-events-and-connections-tf3647567.html#a10196859
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to