cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject git commit: [CXF-5834] WS-RM's JAXB marshalling/unmarshalling is not thread-safe
Date Mon, 30 Jun 2014 18:25:53 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.6.x-fixes 1705271ca -> 1ae35cfba


[CXF-5834] WS-RM's JAXB marshalling/unmarshalling is not thread-safe


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1ae35cfb
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1ae35cfb
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1ae35cfb

Branch: refs/heads/2.6.x-fixes
Commit: 1ae35cfba434df153da098afb51490d90a3dacf0
Parents: 1705271c
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Mon Jun 30 20:23:54 2014 +0200
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Mon Jun 30 20:25:41 2014 +0200

----------------------------------------------------------------------
 .../cxf/ws/rm/persistence/PersistenceUtils.java | 23 ++------------------
 1 file changed, 2 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1ae35cfb/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
index 247656c..079ec00 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/PersistenceUtils.java
@@ -24,8 +24,6 @@ import java.io.InputStream;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
 
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
@@ -38,9 +36,6 @@ public final class PersistenceUtils {
     
     private static PersistenceUtils instance;
     private JAXBContext context;
-    private Unmarshaller unmarshaller;
-    private Marshaller marshaller;
-    
 
     /**
      * Prevents instantiation.
@@ -58,7 +53,7 @@ public final class PersistenceUtils {
     public SequenceAcknowledgement deserialiseAcknowledgment(InputStream is) {
         Object obj = null;
         try {
-            obj = getUnmarshaller().unmarshal(is);
+            obj = getContext().createUnmarshaller().unmarshal(is);
             if (obj instanceof JAXBElement<?>) {
                 JAXBElement<?> el = (JAXBElement<?>)obj;
                 obj = el.getValue();
@@ -72,7 +67,7 @@ public final class PersistenceUtils {
     public InputStream serialiseAcknowledgment(SequenceAcknowledgement ack) {
         LoadingByteArrayOutputStream bos = new LoadingByteArrayOutputStream(); 
         try {
-            getMarshaller().marshal(ack, bos);
+            getContext().createMarshaller().marshal(ack, bos);
         } catch (JAXBException ex) {
             throw new RMStoreException(ex);
         }
@@ -87,18 +82,4 @@ public final class PersistenceUtils {
         }
         return context;
     }
-      
-    private Unmarshaller getUnmarshaller() throws JAXBException {
-        if (null == unmarshaller) {
-            unmarshaller = getContext().createUnmarshaller();
-        }
-        return unmarshaller;
-    }
-    
-    private Marshaller getMarshaller() throws JAXBException {
-        if (null == marshaller) {
-            marshaller = getContext().createMarshaller();
-        }
-        return marshaller;
-    }
 }


Mime
View raw message