Process a "destroy" event for this Context.
()
| 1185 | * Process a "destroy" event for this Context. |
| 1186 | */ |
| 1187 | protected synchronized void destroy() { |
| 1188 | // Called from StandardContext.destroy() |
| 1189 | if (log.isTraceEnabled()) { |
| 1190 | log.trace(sm.getString("contextConfig.destroy")); |
| 1191 | } |
| 1192 | |
| 1193 | // Skip clearing the work directory if Tomcat is being shutdown |
| 1194 | Server s = getServer(); |
| 1195 | if (s != null && !s.getState().isAvailable()) { |
| 1196 | return; |
| 1197 | } |
| 1198 | |
| 1199 | // Changed to getWorkPath per Bugzilla 35819. |
| 1200 | if (context instanceof StandardContext) { |
| 1201 | String workDir = ((StandardContext) context).getWorkPath(); |
| 1202 | if (workDir != null) { |
| 1203 | ExpandWar.delete(new File(workDir)); |
| 1204 | } |
| 1205 | } |
| 1206 | } |
| 1207 | |
| 1208 | |
| 1209 | private Server getServer() { |
no test coverage detected