donaldp 01/12/07 20:31:13
Modified: src/java/org/apache/avalon/phoenix/frontends CLIMain.java
Log:
Made the shutdown() method public so that it can be called from launcher.
Also added a better message to indicate shutdown.
Also fixed a bug where CliMain.main() would actually create a new CLIMain and
work on that. This occured as main() used to be static in CLIMain.
Revision Changes Path
1.15 +19 -9
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/frontends/CLIMain.java
Index: CLIMain.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/frontends/CLIMain.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- CLIMain.java 2001/11/19 12:21:30 1.14
+++ CLIMain.java 2001/12/08 04:31:13 1.15
@@ -41,8 +41,6 @@
*/
public void main( final String args[] )
{
- final CLIMain main = new CLIMain();
-
try
{
final String command = "java " + getClass().getName() + "
[options]";
@@ -60,7 +58,7 @@
final Parameters parameters = setup.getParameters();
final String phoenixHome = System.getProperty( "phoenix.home",
".." );
parameters.setParameter( "phoenix.home", phoenixHome );
- main.execute( parameters );
+ execute( parameters );
}
catch( final Throwable throwable )
{
@@ -140,25 +138,37 @@
*/
protected void forceShutdown()
{
+ if( null == m_hook || null == m_embeddor )
+ {
+ //We were shutdown gracefully but the shutdown hook
+ //thread was not removed. This can occur when an earlier
+ //shutdown hook caused a shutdown() request to be processed
+ return;
+ }
+
final String message = REZ.getString( "main.abnormal-exit.notice" );
System.out.println( message );
System.out.flush();
- //Null hook so it is not tried to be removed
- //when we are shutting down. (Attempting to remove
- //hook during shutdown raises an exception).
- m_hook = null;
-
shutdown();
}
/**
* Shut the embeddor down.
*/
- private synchronized void shutdown()
+ public synchronized void shutdown()
{
+ //Null hook so it is not tried to be removed
+ //when we are shutting down. (Attempting to remove
+ //hook during shutdown raises an exception).
+ m_hook = null;
+
if( null != m_embeddor )
{
+ final String message = REZ.getString( "main.exit.notice" );
+ System.out.println( message );
+ System.out.flush();
+
try
{
m_embeddor.dispose();
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>