}\r
}\r
\r
- ClassLoader oldCtxClassLoader =\r
- Thread.currentThread().getContextClassLoader();\r
- ClassLoader classLoader = instance.getClass().getClassLoader();\r
-\r
PrintStream out = System.out;\r
if (swallowOutput) {\r
SystemLogHandler.startCapture();\r
instanceSupport.fireInstanceEvent\r
(InstanceEvent.BEFORE_DESTROY_EVENT, instance);\r
\r
- Thread.currentThread().setContextClassLoader(classLoader);\r
if( System.getSecurityManager() != null) {\r
SecurityUtil.doAsPrivilege("destroy",\r
instance);\r
(sm.getString("standardWrapper.destroyException", getName()),\r
t);\r
} finally {\r
- // restore the context ClassLoader\r
- Thread.currentThread().setContextClassLoader(oldCtxClassLoader);\r
// Write captured output\r
if (swallowOutput) {\r
String log = SystemLogHandler.stopCapture();\r
\r
if (singleThreadModel && (instancePool != null)) {\r
try {\r
- Thread.currentThread().setContextClassLoader(classLoader);\r
while (!instancePool.isEmpty()) {\r
Servlet s = (Servlet) instancePool.pop();\r
if (System.getSecurityManager() != null) {\r
throw new ServletException\r
(sm.getString("standardWrapper.destroyException",\r
getName()), t);\r
- } finally {\r
- // restore the context ClassLoader\r
- Thread.currentThread().setContextClassLoader\r
- (oldCtxClassLoader);\r
}\r
instancePool = null;\r
nInstances = 0;\r