You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Paul Chen <ch...@gmail.com> on 2006/09/22 08:44:17 UTC
sessionIdle vs. java.util.Timer
Hi, folks,
http://directory.apache.org/subprojects/mina/faq.html#support
says:
---
You can't use sessionIdle event simply here. You'll have to use
java.util.Timer and java.util.TimerTask (or OpenSymphony
Quartz<http://www.opensymphony.com/quartz/>as an alternative).
Schedule a timeout task to be executed on timeout
situation for each request message, and cancel it when you receive the
corresponding response message.
---
Then when is sessionIdle being used?
Thanks for comments
Re: [VOTE] sessionIdle vs. java.util.Timer
Posted by Coding Horse <zh...@hotmail.com>.
What I want to to is:
- create a mina client
- connect to another public socket server
- send something to that server
- if that server sends a response message within 30 seconds, my app will
continue ...
- if not my app will end the connection with that server, I don't want to
wait forever
Do I need Timer/TimerTask for this? What is recommended way to do that?
Appreciate any help!
Coding Horse wrote:
>
> I deadly want to know in which case I "have to use java.util.Timer and
> TimerTask instead of mina provided classes". But that link seems broken
> :-(
>
>
> Paul Chen wrote:
>>
>> Hi, folks,
>>
>> http://directory.apache.org/subprojects/mina/faq.html#support
>>
>> says:
>>
>> ---
>> You can't use sessionIdle event simply here. You'll have to use
>> java.util.Timer and java.util.TimerTask (or OpenSymphony
>> Quartz<http://www.opensymphony.com/quartz/>as an alternative).
>> Schedule a timeout task to be executed on timeout
>> situation for each request message, and cancel it when you receive the
>> corresponding response message.
>> ---
>>
>> Then when is sessionIdle being used?
>>
>> Thanks for comments
>>
>>
>
>
--
View this message in context: http://www.nabble.com/sessionIdle-vs.-java.util.Timer-tf2697392.html#a9320628
Sent from the mina dev mailing list archive at Nabble.com.
Re: [VOTE] sessionIdle vs. java.util.Timer
Posted by Coding Horse <zh...@hotmail.com>.
Thanks a lot Maarten! Finally I realized why I missed the FAQ i was looking
for - I searched with text "timer" however the FAQ contains no "timer" but
"java.util.concurrent.ScheduledExecutor" :-)
Maarten Bosteels-4 wrote:
>
> Yes, most links on the FAQ are broken, it's probably a Confluence bug,
> and it has been reported on this list before.
>
> work-around: just scroll down :-) http://mina.apache.org/faq.html
>
> I do not know Confluence, maybe there is a hook in confluence that
> allows to perform this command everytime the page is re-created ?
>
> sed -i 's|%253F|%3F|g' faq.html
>
> Or even better, maybe Atlassian already fixed the bug in Confluence ?
> Is this bug biting us : http://jira.atlassian.com/browse/CONF-4540 ?
>
> Maarten
>
>
> On 3/5/07, Coding Horse <zh...@hotmail.com> wrote:
>>
>> I deadly want to know in which case I "have to use java.util.Timer and
>> TimerTask instead of mina provided classes". But that link seems broken
>> :-(
>>
>>
>> Paul Chen wrote:
>> >
>> > Hi, folks,
>> >
>> > http://directory.apache.org/subprojects/mina/faq.html#support
>> >
>> > says:
>> >
>> > ---
>> > You can't use sessionIdle event simply here. You'll have to use
>> > java.util.Timer and java.util.TimerTask (or OpenSymphony
>> > Quartz<http://www.opensymphony.com/quartz/>as an alternative).
>> > Schedule a timeout task to be executed on timeout
>> > situation for each request message, and cancel it when you receive the
>> > corresponding response message.
>> > ---
>> >
>> > Then when is sessionIdle being used?
>> >
>> > Thanks for comments
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/sessionIdle-vs.-java.util.Timer-tf2697392.html#a9320467
>> Sent from the mina dev mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/sessionIdle-vs.-java.util.Timer-tf2697392.html#a9322107
Sent from the mina dev mailing list archive at Nabble.com.
Re: [VOTE] sessionIdle vs. java.util.Timer
Posted by Trustin Lee <tr...@gmail.com>.
2007-03-05 (월), 22:33 +0100, Maarten Bosteels 쓰시길:
> Yes, most links on the FAQ are broken, it's probably a Confluence bug,
> and it has been reported on this list before.
>
> work-around: just scroll down :-) http://mina.apache.org/faq.html
>
> I do not know Confluence, maybe there is a hook in confluence that
> allows to perform this command everytime the page is re-created ?
>
> sed -i 's|%253F|%3F|g' faq.html
Thanks Maarten for the tip. I will try this workaround.
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6
Re: [VOTE] sessionIdle vs. java.util.Timer
Posted by Maarten Bosteels <mb...@gmail.com>.
Yes, most links on the FAQ are broken, it's probably a Confluence bug,
and it has been reported on this list before.
work-around: just scroll down :-) http://mina.apache.org/faq.html
I do not know Confluence, maybe there is a hook in confluence that
allows to perform this command everytime the page is re-created ?
sed -i 's|%253F|%3F|g' faq.html
Or even better, maybe Atlassian already fixed the bug in Confluence ?
Is this bug biting us : http://jira.atlassian.com/browse/CONF-4540 ?
Maarten
On 3/5/07, Coding Horse <zh...@hotmail.com> wrote:
>
> I deadly want to know in which case I "have to use java.util.Timer and
> TimerTask instead of mina provided classes". But that link seems broken :-(
>
>
> Paul Chen wrote:
> >
> > Hi, folks,
> >
> > http://directory.apache.org/subprojects/mina/faq.html#support
> >
> > says:
> >
> > ---
> > You can't use sessionIdle event simply here. You'll have to use
> > java.util.Timer and java.util.TimerTask (or OpenSymphony
> > Quartz<http://www.opensymphony.com/quartz/>as an alternative).
> > Schedule a timeout task to be executed on timeout
> > situation for each request message, and cancel it when you receive the
> > corresponding response message.
> > ---
> >
> > Then when is sessionIdle being used?
> >
> > Thanks for comments
> >
> >
>
> --
> View this message in context: http://www.nabble.com/sessionIdle-vs.-java.util.Timer-tf2697392.html#a9320467
> Sent from the mina dev mailing list archive at Nabble.com.
>
>
Re: [VOTE] sessionIdle vs. java.util.Timer
Posted by Coding Horse <zh...@hotmail.com>.
I deadly want to know in which case I "have to use java.util.Timer and
TimerTask instead of mina provided classes". But that link seems broken :-(
Paul Chen wrote:
>
> Hi, folks,
>
> http://directory.apache.org/subprojects/mina/faq.html#support
>
> says:
>
> ---
> You can't use sessionIdle event simply here. You'll have to use
> java.util.Timer and java.util.TimerTask (or OpenSymphony
> Quartz<http://www.opensymphony.com/quartz/>as an alternative).
> Schedule a timeout task to be executed on timeout
> situation for each request message, and cancel it when you receive the
> corresponding response message.
> ---
>
> Then when is sessionIdle being used?
>
> Thanks for comments
>
>
--
View this message in context: http://www.nabble.com/sessionIdle-vs.-java.util.Timer-tf2697392.html#a9320467
Sent from the mina dev mailing list archive at Nabble.com.
Re: sessionIdle vs. java.util.Timer
Posted by Niklas Therning <ni...@trillian.se>.
For simple request-response protocols like HTTP sesssionIdle will work
just fine. In protocols like these the client sends a single request and
then waits for a response to that request. When the protocol allows
several requests to be sent at once things will get trickier.
/Niklas
Greg Duffy wrote:
> sessionIdle cannot detect a missing response to a specific message,
> that capability is always protocol specific. It can, however, detect
> idle TCP connections where no messages being sent, received, or both.
>
> HTH
> -Greg
>
> On 9/22/06, Paul Chen <ch...@gmail.com> wrote:
>> Hi, folks,
>>
>> http://directory.apache.org/subprojects/mina/faq.html#support
>>
>> says:
>>
>> ---
>> You can't use sessionIdle event simply here. You'll have to use
>> java.util.Timer and java.util.TimerTask (or OpenSymphony
>> Quartz<http://www.opensymphony.com/quartz/>as an alternative).
>> Schedule a timeout task to be executed on timeout
>> situation for each request message, and cancel it when you receive the
>> corresponding response message.
>> ---
>>
>> Then when is sessionIdle being used?
>>
>> Thanks for comments
>>
>>
Re: sessionIdle vs. java.util.Timer
Posted by Greg Duffy <gd...@gmail.com>.
sessionIdle cannot detect a missing response to a specific message,
that capability is always protocol specific. It can, however, detect
idle TCP connections where no messages being sent, received, or both.
HTH
-Greg
On 9/22/06, Paul Chen <ch...@gmail.com> wrote:
> Hi, folks,
>
> http://directory.apache.org/subprojects/mina/faq.html#support
>
> says:
>
> ---
> You can't use sessionIdle event simply here. You'll have to use
> java.util.Timer and java.util.TimerTask (or OpenSymphony
> Quartz<http://www.opensymphony.com/quartz/>as an alternative).
> Schedule a timeout task to be executed on timeout
> situation for each request message, and cancel it when you receive the
> corresponding response message.
> ---
>
> Then when is sessionIdle being used?
>
> Thanks for comments
>
>