You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ay...@apache.org on 2014/06/30 20:24:27 UTC
git commit: [CXF-5834] WS-RM's JAXB marshalling/unmarshalling is not
thread-safe
Repository: cxf
Updated Branches:
refs/heads/master 2a614f6ed -> 074e91ac5
[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/074e91ac
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/074e91ac
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/074e91ac
Branch: refs/heads/master
Commit: 074e91ac5c58715e354c01bd3b2d09c051462e34
Parents: 2a614f6
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:24:12 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/074e91ac/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;
- }
}