KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > spice > netserve > connection > impl > AvalonAcceptorManager


1 package org.codehaus.spice.netserve.connection.impl;
2
3 import org.apache.avalon.framework.activity.Disposable;
4 import org.apache.avalon.framework.activity.Initializable;
5 import org.apache.avalon.framework.configuration.Configurable;
6 import org.apache.avalon.framework.configuration.Configuration;
7 import org.apache.avalon.framework.configuration.ConfigurationException;
8 import org.apache.avalon.framework.logger.LogEnabled;
9 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  * &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  * @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
31    extends DefaultAcceptorManager
32    implements LogEnabled, Configurable, Initializable, Disposable
33 {
34    /**
35     * @phoenix.logger
36     */

37    public void enableLogging( final Logger logger )
38    {
39       setMonitor( new AvalonAcceptorMonitor( logger ) );
40    }
41
42    /**
43     * @phoenix.configuration type="http://relaxng.org/ns/structure/1.0"
44     * location="AcceptorManager-schema.xml"
45     */

46    public void configure( final Configuration configuration )
47       throws ConfigurationException
48    {
49       setShutdownTimeout( configuration.getChild( "shutdownTimeout" ).getValueAsInteger( 0 ) );
50    }
51
52    /**
53     * Nothing to do to initial AcceptorManager.
54     */

55    public void initialize()
56       throws Exception JavaDoc
57    {
58    }
59
60    /**
61     * Shutdown all connections.
62     */

63    public void dispose()
64    {
65       shutdownAcceptors();
66    }
67 }
68
Popular Tags