You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Steffen Heil (Mailinglisten)" <li...@steffen-heil.de> on 2013/02/24 20:19:46 UTC

Connector with wrong protocol

Hi

I need to start and stop a connector inside a servlet.
That works with the following code:

		final org.apache.catalina.connector.Connector nioConnector =
			new org.apache.catalina.connector.Connector(
"org.apache.coyote.http11.Http11NioProtocol" );
		nioConnector.setAttribute( "executor", "osiris4Executor" );
		nioConnector.setPort( port );
		nioConnector.setRedirectPort( 443 );
		service.addConnector( nioConnector );

Then I can access the application using that port.
I can also remove the connector again:

		try {
			nioConnector.stop();
		} catch ( LifecycleException e ) {
			e.printStackTrace();
		}
		service.removeConnector( nioConnector );

However, I seem to miss some step, because a
"NioBlockingSelector.BlockPoller-X" thread is left.
As I called the upper code in a testcase in a loop I ended up with lots of
such threads.

What do I have to do to completely remove a connector?

(BTW: How can I find and use an executor that is defined in server.xml using
the code above?)

Regards,
  Steffen