Ashish, The following seems to work. Don't know if there are any side effects yet:

acceptor = new NioDatagramAcceptor(Executors.newCachedThreadPool());
           acceptor.setHandler(new DataMonitorHandler(this));
           acceptor.setSessionRecycler(new ExpiringSessionRecycler(150));

Initializing the ExpiringSessionRecycler(150) to 150 seconds actually causes the session to time out after 150 seconds of inactivity. I don't know if this attaches each IoSession for each client. Any thoughts?

Greg.


Ashish wrote:
On Thu, Jan 29, 2009 at 7:20 PM, Gregory Brownell
<[email protected]> wrote:
Ashish,

Thanks again for looking into this.  Note that this is a receive only
application.  The device(s) sending the packets have no capability to read
anything.  So I don't need to worry about writing at all.

What's important here is the timeout.  I suppose I could just write a timer
that times out after N minutes and is interrupted and reset after each
packet is received, and not worry about session closing/recycling.  But when
I think about how to handle this with multiple clients opening and closing
all the time I get a headache.

Ok, its interesting now :-)

have 2 solutions for you
1. Write Custom Session Recycler and set to Datagram Acceptor

2. See the ExpirationTimer class in MINA source and can refine the same.

Effectively speaking, the timetolive variable is not set for ExpiringObject.

Emmanuel: Should we file a JIRA issue for this?

- ashish
.

Reply via email to