You could just use java.util.Timer and handle this yourself. When you send data, you could schedule a TimerTask with the timer. If you receive a response, cancle the TimerTask. If you don't receive a response, the TimerTask will execute and you can perform your timeout code there.
-Mike FredAtMina wrote: > Hi all, > > I'm using mina in order to send / receive 1 byte at a time. I would like to > use the IDLE timer so I can have this behavior: > reset the READER_IDLE timer just after sending data, so the > ioHandler.sessionIdle is called whenever the server takes longer then the > READER_IDLE to reply to the client. > So, for example, if the TIMOUT is set to 1 second, I want > ioHandler.sessionIdle to be called when there is more than 1 second of delay > between the send and the receive, not between the last two receive... > > As I don't see any "reset" in the IoSession API, I'm thinking about: > - using BOTH_IDLE, but I'm not sure it is doing what I want (i.e. is the > time reset whenever there is a write or a read) ? > (having BOTH_IDLE and READ_IDLE should meet my requirement if this works as > I hope) > - using the getLastReadTime and getLastWriteTime to approximate this > behavior, > but before that, I want to be sure there is no way to reset the timer. > > Regards, > > Fred
