[rhmessaging-commits] rhmessaging commits: r3799 - store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Thu Jan 14 12:19:57 EST 2010
Author: rgemmell
Date: 2010-01-14 12:19:57 -0500 (Thu, 14 Jan 2010)
New Revision: 3799
Modified:
store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreBindingsWorkaround.java
Log:
Use a FileNotFoundException instead of System.exit(1) and so restrict all use of System.exit() to the main() method
Modified: store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreBindingsWorkaround.java
===================================================================
--- store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreBindingsWorkaround.java 2010-01-14 15:05:28 UTC (rev 3798)
+++ store/branches/java/0.5-release/src/tools/java/org/apache/qpid/server/store/berkeleydb/BDBStoreBindingsWorkaround.java 2010-01-14 17:19:57 UTC (rev 3799)
@@ -44,6 +44,7 @@
import com.sleepycat.je.DatabaseException;
import java.io.File;
+import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -51,6 +52,7 @@
public class BDBStoreBindingsWorkaround
{
private static final Logger _logger = LoggerFactory.getLogger(BDBStoreBindingsWorkaround.class);
+ protected static final String CONFIG_NOT_FOUND = "BROKER_CONFIG_NOT_FOUND";
private Configuration _config;
private boolean _initialised = false;
@@ -62,17 +64,26 @@
try
{
tool.start();
+
+ //Shut down the JVM gracefully, the ShutdownHook will stop the VirtualHosts.
+ System.exit(0);
}
+ catch(FileNotFoundException e)
+ {
+ if(!e.getMessage().equals(CONFIG_NOT_FOUND))
+ {
+ e.printStackTrace();
+ _logger.error("Error during workaround process");
+ }
+ }
catch (Exception e)
{
e.printStackTrace();
_logger.error("Error during workaround process");
- //Shut down the JVM, the ShutdownHook will stop the VirtualHosts if initialised.
- System.exit(1);
}
-
- //Shut down the JVM gracefully, the ShutdownHook will stop the VirtualHosts.
- System.exit(0);
+
+ //Shut down the JVM, the ShutdownHook will stop the VirtualHosts if initialised.
+ System.exit(1);
}
public BDBStoreBindingsWorkaround(String[] args) throws InitException
@@ -126,7 +137,7 @@
}
}
- protected void start() throws Exception
+ protected void start() throws FileNotFoundException, Exception
{
_initialised = false;
@@ -146,7 +157,7 @@
{
_logger.error("Config file not found:" + configFile.getAbsolutePath());
_logger.error("Options: [-c <broker config file>] : Defaults to \"$QPID_HOME/etc/config.xml\"");
- System.exit(1);
+ throw new FileNotFoundException(CONFIG_NOT_FOUND);
}
else
{
More information about the rhmessaging-commits
mailing list