Lines 111-126
Link Here
|
111 |
Mutex.EVENT.readAccess(DO_EXIT); |
111 |
Mutex.EVENT.readAccess(DO_EXIT); |
112 |
} |
112 |
} |
113 |
|
113 |
|
|
|
114 |
public void exit(int status) { |
115 |
ExitActions action = new ExitActions(0, status); |
116 |
Mutex.EVENT.readAccess(action); |
117 |
} |
118 |
|
114 |
private static class ExitActions implements Runnable { |
119 |
private static class ExitActions implements Runnable { |
115 |
private final int type; |
120 |
private final int type; |
|
|
121 |
private final int status; |
116 |
ExitActions(int type) { |
122 |
ExitActions(int type) { |
117 |
this.type = type; |
123 |
this.type = type; |
|
|
124 |
this.status = 0; |
125 |
} |
126 |
|
127 |
ExitActions(int type, int status) { |
128 |
this.type = type; |
129 |
this.status = status; |
118 |
} |
130 |
} |
119 |
|
131 |
|
120 |
public void run() { |
132 |
public void run() { |
121 |
switch (type) { |
133 |
switch (type) { |
122 |
case 0: |
134 |
case 0: |
123 |
doExit(); |
135 |
doExit(status); |
124 |
break; |
136 |
break; |
125 |
case 1: |
137 |
case 1: |
126 |
CLIHandler.stopServer(); |
138 |
CLIHandler.stopServer(); |
Lines 132-143
Link Here
|
132 |
} |
144 |
} |
133 |
if (Boolean.getBoolean("netbeans.close.when.invisible")) { |
145 |
if (Boolean.getBoolean("netbeans.close.when.invisible")) { |
134 |
// hook to permit perf testing of time to *apparently* shut down |
146 |
// hook to permit perf testing of time to *apparently* shut down |
135 |
TopSecurityManager.exit(0); |
147 |
TopSecurityManager.exit(status); |
136 |
} |
148 |
} |
137 |
break; |
149 |
break; |
138 |
case 2: |
150 |
case 2: |
139 |
if (!Boolean.getBoolean("netbeans.close.no.exit")) { // NOI18N |
151 |
if (!Boolean.getBoolean("netbeans.close.no.exit")) { // NOI18N |
140 |
TopSecurityManager.exit(0); |
152 |
TopSecurityManager.exit(status); |
141 |
} |
153 |
} |
142 |
break; |
154 |
break; |
143 |
default: |
155 |
default: |
Lines 156-162
Link Here
|
156 |
return doingExit; |
168 |
return doingExit; |
157 |
} |
169 |
} |
158 |
|
170 |
|
159 |
private static void doExit() { |
171 |
private static void doExit(int status) { |
160 |
if (doingExit) { |
172 |
if (doingExit) { |
161 |
return ; |
173 |
return ; |
162 |
} |
174 |
} |
Lines 164-170
Link Here
|
164 |
// save all open files |
176 |
// save all open files |
165 |
try { |
177 |
try { |
166 |
if ( System.getProperty ("netbeans.close") != null || ExitDialog.showDialog() ) { |
178 |
if ( System.getProperty ("netbeans.close") != null || ExitDialog.showDialog() ) { |
167 |
if (org.netbeans.core.startup.Main.getModuleSystem().shutDown(new ExitActions(1))) { |
179 |
if (org.netbeans.core.startup.Main.getModuleSystem().shutDown(new ExitActions(1, status))) { |
168 |
try { |
180 |
try { |
169 |
try { |
181 |
try { |
170 |
NbLoaderPool.store(); |
182 |
NbLoaderPool.store(); |
Lines 189-195
Link Here
|
189 |
// exit is dispatched through that proprietary queue and it |
201 |
// exit is dispatched through that proprietary queue and it |
190 |
// can be refused by security check. So, we need to replan |
202 |
// can be refused by security check. So, we need to replan |
191 |
// to RequestProcessor to avoid security problems. |
203 |
// to RequestProcessor to avoid security problems. |
192 |
Task exitTask = new Task(new ExitActions(2)); |
204 |
Task exitTask = new Task(new ExitActions(2, status)); |
193 |
RequestProcessor.getDefault().post(exitTask); |
205 |
RequestProcessor.getDefault().post(exitTask); |
194 |
exitTask.waitFinished(); |
206 |
exitTask.waitFinished(); |
195 |
} |
207 |
} |