View Javadoc

1   package org.codehaus.spice.netserve.connection.impl;
2   
3   import org.codehaus.dna.Configuration;
4   import org.codehaus.dna.ConfigurationException;
5   import org.codehaus.dna.Active;
6   import org.codehaus.dna.Configurable;
7   import org.codehaus.dna.LogEnabled;
8   import org.codehaus.dna.Logger;
9   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   *  &lt;!-- wait 200ms for connections to gracefully shutdown --&gt;
20   *  &lt;shutdownTimeout&gt;200&lt;/shutdownTimeout&gt;
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
30     extends DefaultAcceptorManager
31     implements LogEnabled, Configurable, Active
32  {
33     /***
34      * @dna.logger
35      */
36     public void enableLogging( final Logger logger )
37     {
38        setMonitor( new DNAAcceptorMonitor( logger ) );
39     }
40  
41     /***
42      * @dna.configuration type="http://relaxng.org/ns/structure/1.0"
43      *    location="AcceptorManager-schema.xml"
44      */
45     public void configure( final Configuration configuration )
46        throws ConfigurationException
47     {
48        setShutdownTimeout( configuration.getChild( "shutdownTimeout" ).getValueAsInteger( 0 ) );
49     }
50  
51     /***
52      * Nothing to do to initial AcceptorManager.
53      */
54     public void initialize()
55        throws Exception
56     {
57     }
58  
59     /***
60      * Shutdown all connections.
61      */
62     public void dispose()
63     {
64        shutdownAcceptors();
65     }
66  }