2013/2/26 Steffen Heil (Mailinglisten) <li...@steffen-heil.de>:
> 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.
>

Tomcat version = ?

I'd call destroy()
http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/Lifecycle.html


> 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?)

service.getExecutor(executorName)
nioConnector.getProtocolHandler().setExecutor(executor)

(as used by o.a.c.startup.ConnectorCreateRule )

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to