Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 22840 invoked from network); 28 Apr 2005 05:28:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Apr 2005 05:28:48 -0000 Received: (qmail 44786 invoked by uid 500); 28 Apr 2005 05:29:48 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 44743 invoked by uid 500); 28 Apr 2005 05:29:47 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 44727 invoked by uid 99); 28 Apr 2005 05:29:47 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from e1.ny.us.ibm.com (HELO e1.ny.us.ibm.com) (32.97.182.141) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 27 Apr 2005 22:29:47 -0700 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e1.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id j3S5Shgo025313 for ; Thu, 28 Apr 2005 01:28:43 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j3S5Sg8q061926 for ; Thu, 28 Apr 2005 01:28:42 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11/8.13.3) with ESMTP id j3S5SgwO022451 for ; Thu, 28 Apr 2005 01:28:42 -0400 Received: from [127.0.0.1] (sig-9-48-113-138.mts.ibm.com [9.48.113.138]) by d01av03.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j3S5Sfag022426 for ; Thu, 28 Apr 2005 01:28:42 -0400 Message-ID: <42707488.4060107@sbcglobal.net> Date: Wed, 27 Apr 2005 22:28:40 -0700 From: Kathey Marsden User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Development Subject: Re: [jira] Commented: (DERBY-214) Remove System.exit() calls from the DB2jServerImpl.java References: <124244851.1114624173884.JavaMail.jira@ajax.apache.org> In-Reply-To: <124244851.1114624173884.JavaMail.jira@ajax.apache.org> X-Enigmail-Version: 0.85.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N David Van Couvering (JIRA) wrote: > > Is it OK for NetworkServerControl to call System.exit, or does that need to throw an exception as well? > >The technique I usually do for a utility that I want callable by another class as well as executable from the command line is for the main() routine to delegate to another public method which throws exceptions and doesn't call System.exit(). Then the main() routine catches any exceptions and calls System.exit(1) if there is an exception or System.exit(0) if there isn't one. Then classes call the other public method and main() is only used from the command-line. > > The execute() method which is the one with the System.exit is only called by NetworkServerControl.main() so I guess it is the exit even from main that is causing a problem with eclipse. For the exit(0), I guess we could just return. For the exit(1) case I am not entirely sure what is appropriate. Maybe main should just throw the exception then we get an error exit but the calling program won't exit completely. Rajesh filed the original case when he had a problem with eclipse exiting completely when he tried to use the main method from within eclipse. Rajesh could you confirm that that is the case? Kathey