Author: alessio.soldano(a)jboss.com
Date: 2008-08-01 12:31:13 -0400 (Fri, 01 Aug 2008)
New Revision: 7992
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/Constants.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
Log:
[JBWS-2207] Adding option for eagerly initialize the JAXBContext cache
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/Constants.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/Constants.java 2008-08-01
16:29:11 UTC (rev 7991)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/Constants.java 2008-08-01
16:31:13 UTC (rev 7992)
@@ -323,4 +323,6 @@
static final String WSDL20_PATTERN_OUT_OPT_IN =
"http://www.w3.org/2004/08/wsdl/out-opt-in";
static final String ASYNC_METHOD_SUFFIX = "Async";
+
+ static final String EAGER_INITIALIZE_JAXB_CONTEXT_CACHE =
"org.jboss.ws.eagerInitializeJAXBContextCache";
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2008-08-01
16:29:11 UTC (rev 7991)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2008-08-01
16:31:13 UTC (rev 7992)
@@ -37,6 +37,7 @@
import java.util.Set;
import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.bind.JAXBContext;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.ws.WebServiceFeature;
@@ -540,6 +541,7 @@
eagerInitializeOperations();
eagerInitializeTypes();
eagerInitializeAccessors();
+ eagerInitializeJAXBContextCache();
}
private void eagerInitializeOperations()
@@ -673,7 +675,32 @@
if (retParam != null)
createAccessor(retParam, jaxbCtx);
}
+
}
+
+ private void eagerInitializeJAXBContextCache()
+ {
+ //initialize jaxb context cache
+ if
("true".equalsIgnoreCase(System.getProperty(Constants.EAGER_INITIALIZE_JAXB_CONTEXT_CACHE)))
+ {
+ log.debug("Initializing JAXBContext cache...");
+ BindingCustomization bindingCustomization = null;
+ if(this instanceof ServerEndpointMetaData)
+ {
+ bindingCustomization =
((ServerEndpointMetaData)this).getEndpoint().getAttachment(BindingCustomization.class);
+ }
+ try
+ {
+ Class[] classes = getRegisteredTypes().toArray(new Class[0]);
+ JAXBContext context = JAXBContextFactory.newInstance().createContext(classes,
bindingCustomization);
+ jaxbCache.add(classes, context);
+ }
+ catch (Exception e)
+ {
+ //ignore
+ }
+ }
+ }
private void createAccessor(ParameterMetaData paramMetaData, JAXBRIContext jaxbCtx)
{
Show replies by date