Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2E44FF28D for ; Mon, 13 May 2013 21:11:22 +0000 (UTC) Received: (qmail 27170 invoked by uid 500); 13 May 2013 21:11:18 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 27093 invoked by uid 500); 13 May 2013 21:11:18 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 27083 invoked by uid 99); 13 May 2013 21:11:18 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 May 2013 21:11:18 +0000 Received: from localhost (HELO [192.168.23.9]) (127.0.0.1) (smtp-auth username markt, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 May 2013 21:11:18 +0000 Message-ID: <519156F1.5040206@apache.org> Date: Mon, 13 May 2013 22:11:13 +0100 From: Mark Thomas User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Port still busy after removing connector in Embedded Tomcat 7.0.30 References: <1368459254.93560.YahooMailNeo@web190701.mail.sg3.yahoo.com> In-Reply-To: <1368459254.93560.YahooMailNeo@web190701.mail.sg3.yahoo.com> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 13/05/2013 16:34, Chirag Dewan wrote: > Hi, > > I am embedding Apache Tomcat 7.0.30 in my application. I am using the Tomcat class,and my application requires dynamic addition and removal of connectors(HTTP). > > Now while removing the connectors,the application gets undeployed but the port remains occupied and the connector continue to listen on the port. I am using customized HTTP connector. > > > Here is a snippet from my source code: > > for removing connector: > > if( connector != null ) > { > connector.decUsage(); > if( connector.getUsage() == 0 ) > { > connector.stop(); > this.tomcat.getService().removeConnector( connector ); > } > } > > for adding connector: > > this.tomcat.getService().addConnector( connector ); > > > I know the port is not getting free. Because when I try to deploy to the same port again,it gives me an address already in use exception. > I have surfed for this issue a lot,but to no avail. Any help would be greatly appreciated. You need to destroy the connector to close the port. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org