|
|
Choosing A Webhost: |
[jira] Commented: (DERBY-214) Remove System.exit() calls from the DB2jServe: msg#00655apache.db.derby.devel
[ http://issues.apache.org/jira/browse/DERBY-214?page=comments#action_64106 ] Craig Russell commented on DERBY-214: ------------------------------------- Hi, I agree that main() should only be used from the command line, and is the only place in the code where System.exit() should be called. The main() method could simply delegate to another method that takes the String args[] parameter. For the purposes of this message, I'll just call it "execute". All of the utility programs should use the same method name for the "execute" method so it's easy to remember how to invoke it. The "execute" then does the parsing of the args. There are lots of Apache commons arg parsers that could be used in the "execute", but that's just a bit off topic. Execute should throw exceptions, not ever call System.exit. Since the execute method has the same parameters as main, it's easy to remember how to invoke it. The second issue is whether the execute method should be static or not. For consistency, I think that non-static would be the way to go. If we offer different methods of executing, then it would be nice to have all of them behave the same in terms of static vs. non-static. The third issue is where the processing of environment variables should be done. It might be best if the constructor of an instance of the utility class processed the environment variables. That way, regardless of whether main() or a program called the constructor the behavior would be the same. The fourth issue is whether for ease of use, aother convenience methods could be used. One that takes a single String is desirable. This method, also called execute, could simply parse the input String into a String[] and call the other execute method. An alternative method would take a Map of parameter names and values with the obvious semantics. I see a few alternatives 1. ij.execute(new String[] {"{"-p", "1567", "-h", "localhost" }); 2. ij.setPort(1567); ij.setHost("localhost");ij.execute(); 3. ij.execute("-p 1567 -h localhost"); 4. Map map = new HashMap(); map.put("-p", "1567"); map.put("-h", "localhost"); ij.execute(Map map); I can see value in all of these techniques depending on what you have on the caller side of the interface. Regards, Craig > Remove System.exit() calls from the DB2jServerImpl.java > ------------------------------------------------------- > > Key: DERBY-214 > URL: http://issues.apache.org/jira/browse/DERBY-214 > Project: Derby > Type: Bug > Components: Network Server > Versions: 10.1.0.0 > Reporter: Kathey Marsden > Assignee: David Van Couvering > > The System.exit() calls needs to be removed from the > DB2jServerImpl.java as this results in the entire application > (example - Eclipse which is running the Network Server inside > it) getting shut down. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [jira] Updated: (DERBY-243) connection toString should uniquely identify the connection, David Van Couvering |
|---|---|
| Next by Date: | Re: Assigned bugs in Jira, Satheesh Bandaram |
| Previous by Thread: | [jira] Assigned: (DERBY-214) Remove System.exit() calls from the DB2jServerImpl.java, David Van Couvering (JIRA) |
| Next by Thread: | [jira] Created: (DERBY-213) ResultSet.next() after last row of FORWARD_ONLY cursor throws an SQL Exception with Network Server, Kathey Marsden (JIRA) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |