Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[jira] Commented: (DERBY-214) Remove System.exit() calls from the DB2jServe: msg#00655

apache.db.derby.devel

Subject: [jira] Commented: (DERBY-214) Remove System.exit() calls from the DB2jServerImpl.java

[
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>
Google Custom Search

Recently Viewed:
version-control...    qnx.openqnx.dev...    redhat.rhn.user...    ietf.openpgp/20...    mail.mutt.user/...    web.microformat...    java.sync4j.use...    education.ezpro...    user-groups.blu...    solaris.manager...    org.fitug.debat...    technology.erps...    politics.activi...    linux.redhat.fe...    bug-tracking.ma...    xfce.user/2004-...    hams/2004-11/ms...    kde.users.pim/2...    culture.cooking...    freebsd.devel.x...    gnu.m4.adhoc/20...    ngpt.user/2002-...    apple.fink.deve...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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

Navigation