From 4649611e72e6fbb80143972dc2ca04b83f63a382 Mon Sep 17 00:00:00 2001 From: Jim Ma Date: Mon, 2 Dec 2024 11:23:17 +0800 Subject: [PATCH] [JBWS-4433]:Don't create JAXPDelegateClassLoader for each invocation in the CXFServletExt --- .../src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java b/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java index 33dbce8db..f22ca6fb7 100644 --- a/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java +++ b/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java @@ -53,6 +53,7 @@ public class CXFServletExt extends AbstractHTTPServlet implements ServletDelegate { private static final long serialVersionUID = -1820187716558491952L; + private ClassLoader delegateClassLoader; protected Endpoint endpoint; protected Bus bus; @@ -60,6 +61,8 @@ public class CXFServletExt extends AbstractHTTPServlet implements ServletDelegat public void init(ServletConfig sc) throws ServletException { super.init(sc); loadBus(sc); + delegateClassLoader = SecurityActions.createDelegateClassLoader(SecurityActions.getContextClassLoader(), + CXFServletExt.class.getClassLoader()); } protected void loadBus(ServletConfig servletConfig) throws ServletException @@ -160,7 +163,7 @@ protected Bus getBus() private ClassLoader pushServerCL() { ClassLoader current = SecurityActions.getContextClassLoader(); - SecurityActions.setContextClassLoader(SecurityActions.createDelegateClassLoader(current, CXFServletExt.class.getClassLoader())); + SecurityActions.setContextClassLoader(this.delegateClassLoader); return current; }