You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by as...@apache.org on 2015/05/20 09:53:38 UTC
[3/6] cxf git commit: Misc jaxb databinding performance improvements
Misc jaxb databinding performance improvements
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9e306abc
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9e306abc
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9e306abc
Branch: refs/heads/3.0.x-fixes
Commit: 9e306abcbb4398923617c0b53bf76ba8e50c3235
Parents: 0eaa88b
Author: Alessio Soldano <as...@redhat.com>
Authored: Wed May 20 00:41:10 2015 +0200
Committer: Alessio Soldano <as...@redhat.com>
Committed: Wed May 20 09:48:59 2015 +0200
----------------------------------------------------------------------
.../soap/interceptor/RPCInInterceptor.java | 5 ++-
.../java/org/apache/cxf/jaxb/JAXBDataBase.java | 43 ++++++++++++--------
2 files changed, 29 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/9e306abc/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
index cad50af..7bfc409 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
@@ -23,6 +23,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.Iterator;
import java.util.List;
+import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
@@ -88,7 +89,9 @@ public class RPCInInterceptor extends AbstractInDatabindingInterceptor {
}
public void handleMessage(Message message) {
if (isGET(message)) {
- LOG.fine("RPCInInterceptor skipped in HTTP GET method");
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("RPCInInterceptor skipped in HTTP GET method");
+ }
return;
}
DepthXMLStreamReader xmlReader = getXMLStreamReader(message);
http://git-wip-us.apache.org/repos/asf/cxf/blob/9e306abc/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java
----------------------------------------------------------------------
diff --git a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java
index 6c5b055..c4c4ba9 100644
--- a/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java
+++ b/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java
@@ -20,6 +20,7 @@
package org.apache.cxf.jaxb;
import java.lang.annotation.Annotation;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -88,33 +89,39 @@ public abstract class JAXBDataBase {
}
protected Annotation[] getJAXBAnnotation(MessagePartInfo mpi) {
- List<Annotation> annoList = new java.util.concurrent.CopyOnWriteArrayList<Annotation>();
-
- if (mpi != null && mpi.getProperty("parameter.annotations") != null) {
- Annotation[] anns = (Annotation[])mpi.getProperty("parameter.annotations");
- for (Annotation ann : anns) {
- if (ann instanceof XmlList || ann instanceof XmlAttachmentRef
- || ann instanceof XmlJavaTypeAdapter) {
- annoList.add(ann);
- }
+ List<Annotation> annoList = null;
+ if (mpi != null) {
+ annoList = extractJAXBAnnotations((Annotation[])mpi.getProperty("parameter.annotations"));
+ if (annoList == null) {
+ annoList = extractJAXBAnnotations(getReturnMethodAnnotations(mpi));
}
}
- if (annoList.size() == 0 && mpi != null
- && mpi.getMessageInfo() != null
- && isOutputMessage(mpi.getMessageInfo())
- && mpi.getMessageInfo().getOperation() != null
- && mpi.getMessageInfo().getOperation().getProperty("method.return.annotations") != null) {
- OperationInfo op = mpi.getMessageInfo().getOperation();
- Annotation[] anns = (Annotation[])op.getProperty("method.return.annotations");
+ return annoList == null ? new Annotation[0] : annoList.toArray(new Annotation[annoList.size()]);
+ }
+
+ private List<Annotation> extractJAXBAnnotations(Annotation[] anns) {
+ List<Annotation> annoList = null;
+ if (anns != null) {
for (Annotation ann : anns) {
if (ann instanceof XmlList || ann instanceof XmlAttachmentRef
|| ann instanceof XmlJavaTypeAdapter) {
+ if (annoList == null) {
+ annoList = new ArrayList<Annotation>();
+ }
annoList.add(ann);
}
}
-
}
- return annoList.toArray(new Annotation[annoList.size()]);
+ return annoList;
+ }
+
+ private Annotation[] getReturnMethodAnnotations(MessagePartInfo mpi) {
+ AbstractMessageContainer mi = mpi.getMessageInfo();
+ if (mi == null || !isOutputMessage(mi)) {
+ return null;
+ }
+ OperationInfo oi = mi != null ? mi.getOperation() : null;
+ return oi != null ? (Annotation[])oi.getProperty("method.return.annotations") : null;
}
protected boolean isOutputMessage(AbstractMessageContainer messageContainer) {