Author: scheu
Date: Mon Oct 18 21:26:34 2010
New Revision: 1024009
URL: http://svn.apache.org/viewvc?rev=1024009&view=rev
Log:
AXIS2-4844
Contributor:Rich Scheuerle
Slight improvement to ContextUtils.
Slight improvement to JAXBUtils.
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java?rev=1024009&r1=1024008&r2=1024009&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/context/utils/ContextUtils.java
Mon Oct 18 21:26:34 2010
@@ -21,9 +21,11 @@ package org.apache.axis2.jaxws.context.u
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.OperationContext;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.jaxws.Constants;
import org.apache.axis2.jaxws.addressing.util.ReferenceParameterList;
import org.apache.axis2.jaxws.context.WebServiceContextImpl;
@@ -357,18 +359,6 @@ public class ContextUtils {
return false;
}
- // First examine the property on the jaxws MessageContext
- Boolean property = (Boolean) mc.getProperty(
- Constants.JAXWS_JAXB_WRITE_REMOVE_ILLEGAL_CHARS);
- if (property != null) {
- value = property.booleanValue();
- if (log.isDebugEnabled()) {
- log.debug("_isJAXBRemoveIllegalChars returns " + value + " per
jaxws MessageContext property " +
- Constants.JAXWS_JAXB_WRITE_REMOVE_ILLEGAL_CHARS);
- }
- return value;
- }
-
// If not found, delegate to the Axis2 MessageContext
if (mc.getAxisMessageContext() != null) {
return _isJAXBRemoveIllegalChars(mc.getAxisMessageContext());
@@ -396,9 +386,9 @@ public class ContextUtils {
return false;
}
- // First examine the property on the axis2 MessageContext hierarchy
- Boolean property = (Boolean) mc.getProperty(
- Constants.JAXWS_JAXB_WRITE_REMOVE_ILLEGAL_CHARS);
+ // First examine the local property on the axis2 MessageContext
+ Boolean property = (Boolean) mc.getLocalProperty(
+ Constants.JAXWS_JAXB_WRITE_REMOVE_ILLEGAL_CHARS, false);
if (property != null) {
value = property.booleanValue();
if (log.isDebugEnabled()) {
@@ -410,14 +400,20 @@ public class ContextUtils {
// Now look at the configuration parameter
- Parameter p =
mc.getParameter(Constants.JAXWS_JAXB_WRITE_REMOVE_ILLEGAL_CHARS);
- if (p != null) {
- value = JavaUtils.isTrue(p.getValue());
- if (log.isDebugEnabled()) {
- log.debug("isJAXBRemoveIllegalChars returns " + value + " per
inspection of Configuration property " +
- Constants.JAXWS_JAXB_WRITE_REMOVE_ILLEGAL_CHARS);
+ ConfigurationContext cc = mc.getConfigurationContext();
+ if (cc != null) {
+ AxisConfiguration baseConfig = cc.getAxisConfiguration();
+ if (baseConfig != null) {
+ Parameter p =
baseConfig.getParameter(Constants.JAXWS_JAXB_WRITE_REMOVE_ILLEGAL_CHARS);
+ if (p != null) {
+ value = JavaUtils.isTrue(p.getValue());
+ if (log.isDebugEnabled()) {
+ log.debug("isJAXBRemoveIllegalChars returns " + value
+ " per inspection of Configuration property " +
+
Constants.JAXWS_JAXB_WRITE_REMOVE_ILLEGAL_CHARS);
+ }
+ return value;
+ }
}
- return value;
}
if (log.isDebugEnabled()) {
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java?rev=1024009&r1=1024008&r2=1024009&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
Mon Oct 18 21:26:34 2010
@@ -1437,6 +1437,9 @@ public class JAXBUtils {
// The maps are freed up when a LOAD FACTOR is hit
private static int MAX_LIST_FACTOR = 50;
+ // Limit the adjustSize calls
+ private int count = 0;
+
/**
* @param key
* @return removed item from pool or null.
@@ -1509,6 +1512,13 @@ public class JAXBUtils {
* a large footprint.
*/
private void adjustSize() {
+
+ // Don't check each time, map.size() can be expensive
+ count++;
+ if (count < 10) {
+ return;
+ }
+ count = 0;
Map<K,List<V>> map = softMap.get();
if (map != null && map.size() > MAX_LOAD_FACTOR) {
// Remove every other Entry in the map.