01: package org.codehaus.spice.netserve.connection.impl;
02:
03: import org.codehaus.dna.Configuration;
04: import org.codehaus.dna.ConfigurationException;
05: import org.codehaus.dna.Active;
06: import org.codehaus.dna.Configurable;
07: import org.codehaus.dna.LogEnabled;
08: import org.codehaus.dna.Logger;
09: import org.codehaus.spice.netserve.connection.impl.DefaultAcceptorManager;
10:
11: /**
12: * A DNA 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: * @version $Revision: 1.3 $ $Date: 2004/04/25 11:14:17 $
25: * @dna.component
26: * @dna.service type="org.codehaus.spice.netserve.connection.SocketAcceptorManager"
27: * @see org.codehaus.spice.netserve.connection.impl.DefaultAcceptorManager
28: */
29: public class DNAAcceptorManager extends DefaultAcceptorManager
30: implements LogEnabled, Configurable, Active {
31: /**
32: * @dna.logger
33: */
34: public void enableLogging(final Logger logger) {
35: setMonitor(new DNAAcceptorMonitor(logger));
36: }
37:
38: /**
39: * @dna.configuration type="http://relaxng.org/ns/structure/1.0"
40: * location="AcceptorManager-schema.xml"
41: */
42: public void configure(final Configuration configuration)
43: throws ConfigurationException {
44: setShutdownTimeout(configuration.getChild("shutdownTimeout")
45: .getValueAsInteger(0));
46: }
47:
48: /**
49: * Nothing to do to initial AcceptorManager.
50: */
51: public void initialize() throws Exception {
52: }
53:
54: /**
55: * Shutdown all connections.
56: */
57: public void dispose() {
58: shutdownAcceptors();
59: }
60: }
|