Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2017-01-02 16:34:38 +0000
committerEike Stepper2017-01-02 16:34:38 +0000
commitbb6dacda5af21995d9632c1ec9444e7d5e2a63c5 (patch)
tree1c3aeea690448d7947c70c305d997d11a0c6560d
parent514e37b086e63350159b4ba5a3b1fe43ac6fe1b1 (diff)
downloadcdo-bb6dacda5af21995d9632c1ec9444e7d5e2a63c5.tar.gz
cdo-bb6dacda5af21995d9632c1ec9444e7d5e2a63c5.tar.xz
cdo-bb6dacda5af21995d9632c1ec9444e7d5e2a63c5.zip
[509823] No commit context registered with XA transactions
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509823
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/CommitManager.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreThreadLocal.java31
2 files changed, 39 insertions, 8 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/CommitManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/CommitManager.java
index 1316c4d0f1..a65d6b0c71 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/CommitManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/CommitManager.java
@@ -12,6 +12,7 @@
package org.eclipse.emf.cdo.internal.server;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.server.StoreThreadLocal;
import org.eclipse.emf.cdo.spi.server.InternalCommitContext;
import org.eclipse.emf.cdo.spi.server.InternalCommitManager;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
@@ -181,11 +182,18 @@ public class CommitManager extends Lifecycle implements InternalCommitManager
{
public Object call() throws Exception
{
- context.write(monitor);
-
- if (in instanceof Closeable)
+ try
+ {
+ StoreThreadLocal.setCommitContext(context);
+ context.write(monitor);
+ }
+ finally
{
- IOUtil.closeSilent((Closeable)in);
+ StoreThreadLocal.setCommitContext(null);
+ if (in instanceof Closeable)
+ {
+ IOUtil.closeSilent((Closeable)in);
+ }
}
return null;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreThreadLocal.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreThreadLocal.java
index 30bf25c0a5..9f053a1999 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreThreadLocal.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreThreadLocal.java
@@ -41,7 +41,15 @@ public final class StoreThreadLocal
*/
public static void setSession(InternalSession session)
{
- SESSION.set(session);
+ if (session == null)
+ {
+ SESSION.remove();
+ }
+ else
+ {
+ SESSION.set(session);
+ }
+
ACCESSOR.remove();
COMMIT_CONTEXT.remove();
}
@@ -75,8 +83,16 @@ public final class StoreThreadLocal
public static void setAccessor(IStoreAccessor accessor)
{
- SESSION.set(accessor == null ? null : accessor.getSession());
- ACCESSOR.set(accessor);
+ if (accessor == null)
+ {
+ ACCESSOR.remove();
+ SESSION.remove();
+ }
+ else
+ {
+ ACCESSOR.set(accessor);
+ SESSION.set(accessor.getSession());
+ }
}
public static IStoreAccessor getAccessor() throws NoSessionRegisteredException
@@ -95,7 +111,14 @@ public final class StoreThreadLocal
public static void setCommitContext(IStoreAccessor.CommitContext commitContext)
{
- COMMIT_CONTEXT.set(commitContext);
+ if (commitContext == null)
+ {
+ COMMIT_CONTEXT.remove();
+ }
+ else
+ {
+ COMMIT_CONTEXT.set(commitContext);
+ }
}
public static IStoreAccessor.CommitContext getCommitContext()

Back to the top