You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by co...@apache.org on 2002/04/20 14:10:47 UTC
cvs commit: jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy AbstractHttpProxyServer.java Resources.properties
colus 02/04/20 05:10:47
Modified: httpproxy/src/java/org/apache/avalon/httpproxy
AbstractHttpProxyServer.java Resources.properties
Log:
diconnect when disposing.
Revision Changes Path
1.5 +20 -5 jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/AbstractHttpProxyServer.java
Index: AbstractHttpProxyServer.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/AbstractHttpProxyServer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractHttpProxyServer.java 20 Apr 2002 11:37:23 -0000 1.4
+++ AbstractHttpProxyServer.java 20 Apr 2002 12:10:47 -0000 1.5
@@ -11,6 +11,7 @@
import java.net.ServerSocket;
import java.net.UnknownHostException;
import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
@@ -24,7 +25,6 @@
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.phoenix.Block;
import org.apache.avalon.phoenix.BlockContext;
-import org.apache.avalon.phoenix.Service;
import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
import org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory;
import org.apache.avalon.cornerstone.services.connection.ConnectionManager;
@@ -37,8 +37,8 @@
*/
public abstract class AbstractHttpProxyServer
extends AbstractLogEnabled
- implements Block, Contextualizable, Composable, Configurable, Service,
- Initializable, ConnectionHandlerFactory
+ implements Contextualizable, Composable, Configurable,
+ Initializable, Disposable, Block, ConnectionHandlerFactory
{
private static final Resources REZ =
ResourceManager.getPackageResources( AbstractHttpProxyServer.class );
@@ -47,6 +47,7 @@
protected ConnectionManager m_connectionManager;
protected String m_name;
+ protected String m_connectionName;
protected String m_forwardToAnotherProxy;
protected int m_port;
protected InetAddress m_bindTo;
@@ -98,7 +99,8 @@
m_socketManager.getServerSocketFactory( "plain" );
final ServerSocket serverSocket = factory.createServerSocket( m_port, 5, m_bindTo );
- m_connectionManager.connect( "HttpProxyListener-" + m_name, serverSocket, this );
+ m_connectionName = "HttpProxyListener-" + m_name;
+ m_connectionManager.connect( m_connectionName, serverSocket, this );
// This is only to help newbies.....
if ( getLogger().isInfoEnabled() )
@@ -108,6 +110,19 @@
}
}
+ public void dispose()
+ {
+ try
+ {
+ m_connectionManager.disconnect( m_connectionName );
+ }
+ catch( final Exception e )
+ {
+ final String message = REZ.getString( "server.error.disconnect" );
+ getLogger().warn( message, e );
+ }
+ }
+
protected abstract String getShortName();
/**
@@ -127,7 +142,7 @@
/**
* Release a previously created ConnectionHandler e.g. for spooling.
*/
- public void releaseConnectionHandler( ConnectionHandler connectionHandler )
+ public void releaseConnectionHandler( final ConnectionHandler connectionHandler )
{
}
1.2 +2 -1 jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/Resources.properties
Index: Resources.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/Resources.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Resources.properties 20 Apr 2002 11:37:23 -0000 1.1
+++ Resources.properties 20 Apr 2002 12:10:47 -0000 1.2
@@ -1,4 +1,5 @@
-server.notice.ready={0} HTTP Proxy server running. Configure your browser to proxy through localhost:{1} to use it.
+server.notice.ready={0} HTTP Proxy server running. Configure your browser to proxy through localhost:{1,number,integer} to use it.
+server.error.disconnect=Error disconnecting.
handler.notice.timeout=Connection to {0} timeout.
handler.notice.closed-remotely=Connection to {0} closed remotely.
handler.error.open=Exception in proxy opening socket to {0}.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>