diff -r dfc154be2792 core.startup/nbproject/project.xml
--- a/core.startup/nbproject/project.xml Wed Feb 29 06:29:24 2012 -0800
+++ b/core.startup/nbproject/project.xml Thu Mar 01 10:44:04 2012 +0100
@@ -79,7 +79,7 @@
- 8.1
+ 8.23
diff -r dfc154be2792 core.startup/src/org/netbeans/core/startup/ModuleLifecycleManager.java
--- a/core.startup/src/org/netbeans/core/startup/ModuleLifecycleManager.java Wed Feb 29 06:29:24 2012 -0800
+++ b/core.startup/src/org/netbeans/core/startup/ModuleLifecycleManager.java Thu Mar 01 10:44:04 2012 +0100
@@ -67,6 +67,10 @@
private final AtomicBoolean exiting = new AtomicBoolean(false);
public void exit() {
+ exit(0);
+ }
+
+ public void exit(int status) {
if (exiting.getAndSet(true)) {
return;
}
@@ -90,7 +94,7 @@
Exceptions.printStackTrace(t);
}
if (System.getProperty("netbeans.close.no.exit") == null) {
- TopSecurityManager.exit(0);
+ TopSecurityManager.exit(status);
}
}
}
diff -r dfc154be2792 o.n.core/nbproject/project.xml
--- a/o.n.core/nbproject/project.xml Wed Feb 29 06:29:24 2012 -0800
+++ b/o.n.core/nbproject/project.xml Thu Mar 01 10:44:04 2012 +0100
@@ -160,7 +160,7 @@
- 8.17
+ 8.23
diff -r dfc154be2792 o.n.core/src/org/netbeans/core/NbLifecycleManager.java
--- a/o.n.core/src/org/netbeans/core/NbLifecycleManager.java Wed Feb 29 06:29:24 2012 -0800
+++ b/o.n.core/src/org/netbeans/core/NbLifecycleManager.java Thu Mar 01 10:44:04 2012 +0100
@@ -111,16 +111,28 @@
Mutex.EVENT.readAccess(DO_EXIT);
}
+ public void exit(int status) {
+ ExitActions action = new ExitActions(0, status);
+ Mutex.EVENT.readAccess(action);
+ }
+
private static class ExitActions implements Runnable {
private final int type;
+ private final int status;
ExitActions(int type) {
this.type = type;
+ this.status = 0;
+ }
+
+ ExitActions(int type, int status) {
+ this.type = type;
+ this.status = status;
}
public void run() {
switch (type) {
case 0:
- doExit();
+ doExit(status);
break;
case 1:
CLIHandler.stopServer();
@@ -132,12 +144,12 @@
}
if (Boolean.getBoolean("netbeans.close.when.invisible")) {
// hook to permit perf testing of time to *apparently* shut down
- TopSecurityManager.exit(0);
+ TopSecurityManager.exit(status);
}
break;
case 2:
if (!Boolean.getBoolean("netbeans.close.no.exit")) { // NOI18N
- TopSecurityManager.exit(0);
+ TopSecurityManager.exit(status);
}
break;
default:
@@ -156,7 +168,7 @@
return doingExit;
}
- private static void doExit() {
+ private static void doExit(int status) {
if (doingExit) {
return ;
}
@@ -164,7 +176,7 @@
// save all open files
try {
if ( System.getProperty ("netbeans.close") != null || ExitDialog.showDialog() ) {
- if (org.netbeans.core.startup.Main.getModuleSystem().shutDown(new ExitActions(1))) {
+ if (org.netbeans.core.startup.Main.getModuleSystem().shutDown(new ExitActions(1, status))) {
try {
try {
NbLoaderPool.store();
@@ -189,7 +201,7 @@
// exit is dispatched through that proprietary queue and it
// can be refused by security check. So, we need to replan
// to RequestProcessor to avoid security problems.
- Task exitTask = new Task(new ExitActions(2));
+ Task exitTask = new Task(new ExitActions(2, status));
RequestProcessor.getDefault().post(exitTask);
exitTask.waitFinished();
}
diff -r dfc154be2792 openide.util/apichanges.xml
--- a/openide.util/apichanges.xml Wed Feb 29 06:29:24 2012 -0800
+++ b/openide.util/apichanges.xml Thu Mar 01 10:44:04 2012 +0100
@@ -51,6 +51,23 @@
Actions API
+
+
+ Exit with status code
+
+
+
+
+
+
+ LifecycleManager
+ has new exit method allowing callers to specify
+ the exit code.
+
+
+
+
+ @NbBundle.Messages available on fields
diff -r dfc154be2792 openide.util/manifest.mf
--- a/openide.util/manifest.mf Wed Feb 29 06:29:24 2012 -0800
+++ b/openide.util/manifest.mf Thu Mar 01 10:44:04 2012 +0100
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
OpenIDE-Module: org.openide.util
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
-OpenIDE-Module-Specification-Version: 8.22
+OpenIDE-Module-Specification-Version: 8.23
diff -r dfc154be2792 openide.util/src/org/openide/LifecycleManager.java
--- a/openide.util/src/org/openide/LifecycleManager.java Wed Feb 29 06:29:24 2012 -0800
+++ b/openide.util/src/org/openide/LifecycleManager.java Thu Mar 01 10:44:04 2012 +0100
@@ -86,6 +86,17 @@
*/
public abstract void exit();
+ /** Exit NetBeans with the given exit code.
+ * This method will return only if {@link java.lang.System#exit} fails, or if at least one component of the
+ * system refuses to exit (because it cannot be properly shut down).
+ *
+ * @param status the exit code of the application
+ * @since 8.23
+ */
+ public void exit(int status) {
+ exit();
+ }
+
/**
* Request that the application restart immediately after next being shut down.
* You may want to then call {@link #exit} to go ahead and restart now.
@@ -105,6 +116,10 @@
System.exit(0);
}
+ public void exit(int status) {
+ System.exit(status);
+ }
+
public void saveAll() {
}
}