Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2009-12-26 02:22:33 -0500
committerEike Stepper2009-12-26 02:22:33 -0500
commit70e3ba0f16ce541c0e537882224c003bc6636271 (patch)
tree0c729b83262d4be9f3c58bab9c22f102c76f8d2e /plugins
parentce41105c0e4e2b0fe8c4f624e4009339286c97a8 (diff)
downloadcdo-70e3ba0f16ce541c0e537882224c003bc6636271.tar.gz
cdo-70e3ba0f16ce541c0e537882224c003bc6636271.tar.xz
cdo-70e3ba0f16ce541c0e537882224c003bc6636271.zip
[290251] CDOXATransaction commit does not end.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=290251
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java60
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXATransaction.java6
3 files changed, 62 insertions, 10 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
index 1cd69dcd8a..53f02b4979 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
@@ -193,4 +193,10 @@ public class CDOXACommitContextImpl implements InternalCDOXACommitContext
delegateCommitContext.postCommit(result);
}
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOXACommitContext[{0}, {1}]", transactionManager, state);
+ }
};
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java
index ca12749e02..e8913f0a33 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java
@@ -47,13 +47,16 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -96,7 +99,7 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
private List<InternalCDOTransaction> transactions = new ArrayList<InternalCDOTransaction>();
- private boolean allRequestEnabled = true;
+ private boolean allowRequestFromTransactionEnabled = true;
private ExecutorService executorService = createExecutorService();
@@ -118,12 +121,12 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
public boolean isAllowRequestFromTransactionEnabled()
{
- return allRequestEnabled;
+ return allowRequestFromTransactionEnabled;
}
public void setAllowRequestFromTransactionEnabled(boolean allRequest)
{
- allRequestEnabled = allRequest;
+ allowRequestFromTransactionEnabled = allRequest;
}
public void add(InternalCDOTransaction transaction)
@@ -202,26 +205,33 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
try
{
- List<Future<Object>> futures = new ArrayList<Future<Object>>();
+ Map<Future<Object>, InternalCDOXACommitContext> futures = new HashMap<Future<Object>, InternalCDOXACommitContext>();
for (InternalCDOXACommitContext xaContext : xaContexts)
{
xaContext.setProgressMonitor(new SynchronizedSubProgressMonitor(progressMonitor, 1));
- futures.add(executorService.submit(xaContext));
+ Future<Object> future = executorService.submit(xaContext);
+ futures.put(future, xaContext);
}
int nbProcessDone = 0;
do
{
- for (Future<Object> future : futures)
+ for (Iterator<Entry<Future<Object>, InternalCDOXACommitContext>> it = futures.entrySet().iterator(); it
+ .hasNext();)
{
+ Entry<Future<Object>, InternalCDOXACommitContext> entry = it.next();
+ Future<Object> future = entry.getKey();
+ InternalCDOXACommitContext xaContext = entry.getValue();
+
try
{
- future.get(2000, TimeUnit.MILLISECONDS);
+ future.get(1000, TimeUnit.MILLISECONDS);
nbProcessDone++;
+ it.remove();
if (TRACER.isEnabled())
{
- TRACER.format("Got {0}", future);
+ TRACER.format("Got {0}", xaContext);
}
}
catch (TimeoutException ex)
@@ -229,7 +239,7 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
// Just retry
if (TRACER.isEnabled())
{
- TRACER.format("Waiting for {0}", future);
+ TRACER.format("Waiting for {0}", xaContext);
}
}
}
@@ -374,6 +384,12 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
return lastSavepoint;
}
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOXATransaction{0}", transactions);
+ }
+
protected CDOXACommitContextImpl createXACommitContext(InternalCDOCommitContext context)
{
return new CDOXACommitContextImpl(this, context);
@@ -497,7 +513,7 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
private void checkAccess()
{
- if (!allRequestEnabled)
+ if (!allowRequestFromTransactionEnabled)
{
throw new IllegalStateException(Messages.getString("CDOXATransactionImpl.8")); //$NON-NLS-1$
}
@@ -545,6 +561,12 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
xaContext.setResult(result);
xaContext.setState(CDOXAPhase2State.INSTANCE);
}
+
+ @Override
+ public String toString()
+ {
+ return "PHASE1";
+ };
};
/**
@@ -571,6 +593,12 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
xaContext.setState(CDOXAPhase3State.INSTANCE);
}
+
+ @Override
+ public String toString()
+ {
+ return "PHASE2";
+ };
};
/**
@@ -598,6 +626,12 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
xaContext.postCommit(xaContext.getResult());
xaContext.setState(null);
}
+
+ @Override
+ public String toString()
+ {
+ return "PHASE3";
+ };
};
/**
@@ -619,5 +653,11 @@ public class CDOXATransactionImpl implements InternalCDOXATransaction
CommitTransactionResult result = sessionProtocol.commitTransactionCancel(xaContext, monitor);
check_result(result);
}
+
+ @Override
+ public String toString()
+ {
+ return "CANCEL";
+ };
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXATransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXATransaction.java
index 3d3fc0b4dd..1b01830aba 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXATransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXATransaction.java
@@ -109,6 +109,12 @@ public interface InternalCDOXATransaction extends CDOXATransaction, InternalCDOU
{
progressMonitor.done();
}
+
+ @Override
+ public String toString()
+ {
+ return "DONE";
+ };
};
public void check_result(CommitTransactionResult result)

Back to the top