Sorry forgot to send the diff mentioned in last mail
Index: SMTPHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/smtpserver/SMTPHandler.jav
a,v
retrieving revision 1.31
diff -u -r1.31 SMTPHandler.java
--- SMTPHandler.java 17 Oct 2002 22:04:01 -0000 1.31
+++ SMTPHandler.java 24 Oct 2002 02:04:21 -0000
@@ -46,7 +46,7 @@
*/
public class SMTPHandler
extends BaseConnectionHandler
- implements ConnectionHandler, Composable, Configurable, Target {
+ implements ConnectionHandler, Composable, Configurable, Command {
/**
* SMTP Server identification string used in SMTP headers
@@ -223,9 +223,14 @@
private int lengthReset = 20000;
/**
- * The scheduler used to handle timeouts for the SMTP interaction.
+ * The Event Manager used to handle timeouts for the SMTP interaction.
*/
- private TimeScheduler scheduler;
+ private ResettableTimeGuardedCommandMap eventMgr;
+
+ /**
+ * ID used to identify handler with Event Manager
+ */
+ private int handlerEventID;
/**
* The user repository for this server - used to authenticate
@@ -252,9 +257,9 @@
*/
public void compose(final ComponentManager componentManager) throws
ComponentException {
mailServer = (MailServer)
componentManager.lookup("org.apache.james.services.MailServer");
- scheduler =
- (TimeScheduler) componentManager.lookup(
-
"org.apache.avalon.cornerstone.services.scheduler.TimeScheduler");
+ eventMgr =
+ (ResettableTimeGuardedCommandMap) componentManager.lookup(
+ ResettableTimeGuardedCommandMap.ROLE);
UsersStore usersStore =
(UsersStore)
componentManager.lookup("org.apache.james.services.UsersStore");
users = usersStore.getRepository("LocalUsers");
@@ -325,8 +330,7 @@
// Initially greet the connector
// Format is: Sat, 24 Jan 1998 13:16:09 -0500
- final PeriodicTimeTrigger trigger = new PeriodicTimeTrigger(
timeout, -1 );
- scheduler.addTrigger( this.toString(), trigger, this );
+ handlerEventID = eventMgr.add(timeout, this );
StringBuffer responseBuffer =
new StringBuffer(192)
.append("220 ")
@@ -339,7 +343,7 @@
writeLoggedFlushedResponse(responseString);
while (parseCommand(readCommandLine())) {
- scheduler.resetTrigger(this.toString());
+ scheduler.reset(handlerEventID);
}
getLogger().debug("Closing socket.");
} catch (SocketException se) {
@@ -392,7 +396,7 @@
}
// release from scheduler.
try {
- scheduler.removeTrigger(this.toString());
+ eventMgr.remove(handlerEventID);
} catch(Throwable t) { }
}
}
@@ -406,7 +410,7 @@
*
* TODO: Remove this interface from the class and change the mechanism
*/
- public void targetTriggered(final String triggerName) {
+ public void execute() {
getLogger().error("Connection timeout on socket with " + remoteHost
+ " (" + remoteIP + ")");
try {
out.println("Connection timeout. Closing connection");
--
To unsubscribe, e-mail: <mailto:james-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@;jakarta.apache.org>