01: package org.codehaus.spice.netserve.connection.impl;
02:
03: import org.apache.avalon.framework.activity.Disposable;
04: import org.apache.avalon.framework.activity.Initializable;
05: import org.apache.avalon.framework.configuration.Configurable;
06: import org.apache.avalon.framework.configuration.Configuration;
07: import org.apache.avalon.framework.configuration.ConfigurationException;
08: import org.apache.avalon.framework.logger.LogEnabled;
09: import org.apache.avalon.framework.logger.Logger;
10:
11: /**
12: * An Avalon compliant implementation of AcceptorManager.
13: *
14: * <p>The component takes a single configuration parameter;
15: * "shutdownTimeout". This specifies the amount of time to wait
16: * while waiting for connections to shutdown gracefully. A
17: * sample configuration follows;</p>
18: * <pre>
19: * <!-- wait 200ms for connections to gracefully shutdown -->
20: * <shutdownTimeout>200</shutdownTimeout>
21: * </pre>
22: *
23: * @author Peter Donald
24: * @author Mauro Talevi
25: * @version $Revision: 1.1 $ $Date: 2004/07/10 13:06:21 $
26: * @phoenix.component
27: * @phoenix.service type="org.codehaus.spice.netserve.connection.SocketAcceptorManager"
28: * @see org.codehaus.spice.netserve.connection.impl.DefaultAcceptorManager
29: */
30: public class AvalonAcceptorManager extends DefaultAcceptorManager
31: implements LogEnabled, Configurable, Initializable, Disposable {
32: /**
33: * @phoenix.logger
34: */
35: public void enableLogging(final Logger logger) {
36: setMonitor(new AvalonAcceptorMonitor(logger));
37: }
38:
39: /**
40: * @phoenix.configuration type="http://relaxng.org/ns/structure/1.0"
41: * location="AcceptorManager-schema.xml"
42: */
43: public void configure(final Configuration configuration)
44: throws ConfigurationException {
45: setShutdownTimeout(configuration.getChild("shutdownTimeout")
46: .getValueAsInteger(0));
47: }
48:
49: /**
50: * Nothing to do to initial AcceptorManager.
51: */
52: public void initialize() throws Exception {
53: }
54:
55: /**
56: * Shutdown all connections.
57: */
58: public void dispose() {
59: shutdownAcceptors();
60: }
61: }
|