You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Shilpa Dalmia <Sh...@PostX.com> on 2002/05/21 02:39:42 UTC

SMTPHandler connection timeout

In SMTPHandler::handleConnection() method, why do we use the avalon
scheduler & trigger mechanism to handle a connection timeout? Instead why
don't we use the java.net.Socket.setSoTimeout(timeout) method, so when the
connection actually times out, the InterruptedIOException exception will be
thrown (which we're catching anyway) where we can take the same action as is
being taken in the trigger callback method targetTriggered() ?


Shilpa Dalmia
PostX Corporation


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: SMTPHandler connection timeout

Posted by "Noel J. Bergman" <no...@devtech.com>.
> In SMTPHandler::handleConnection() method, why do we use the avalon
> scheduler & trigger mechanism to handle a connection timeout?
> Instead why don't we use the java.net.Socket.setSoTimeout(timeout) method,

Please consider the code:

  final PeriodicTimeTrigger trigger = new PeriodicTimeTrigger(
timeout, -1 );
  scheduler.addTrigger( this.toString(), trigger, this );
  while  (parseCommand(in.readLine()))
scheduler.resetTrigger(this.toString());
  socket.close();
  scheduler.removeTrigger(this.toString());

Note that the trigger protects more than just socket I/O.  It covers the
processing of the command (parseCommand does a lot more than just parse).

	--- Noel


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>