Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2009-01-13 04:11:40 -0500
committerEike Stepper2009-01-13 04:11:40 -0500
commit6c5233a735c56100605f46b59f4e46a7c1cf40dc (patch)
tree12242648387b11bbc99fa4e332a10c95396a69cb /plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction
parent5635ec88448a920dc02e0d649441aa5c4146b259 (diff)
downloadcdo-6c5233a735c56100605f46b59f4e46a7c1cf40dc.tar.gz
cdo-6c5233a735c56100605f46b59f4e46a7c1cf40dc.tar.xz
cdo-6c5233a735c56100605f46b59f4e46a7c1cf40dc.zip
Prepare common query
Diffstat (limited to 'plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction')
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/AbstractSavepoint.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOAbstractSavepoint.java)20
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategy.java)35
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionCommitContext.java)18
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepointImpl.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepoint.java)11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java86
7 files changed, 82 insertions, 95 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOAbstractSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/AbstractSavepoint.java
index dc9c5edbff..ad4c1b8df2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOAbstractSavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/AbstractSavepoint.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* Simon McDuff - initial API and implementation
* Eike Stepper - maintenance
- */
+ **************************************************************************/
package org.eclipse.emf.internal.cdo.transaction;
import org.eclipse.emf.cdo.transaction.CDOSavepoint;
@@ -18,15 +18,15 @@ import org.eclipse.emf.cdo.transaction.CDOUserTransaction;
* @author Simon McDuff
* @since 2.0
*/
-public abstract class CDOAbstractSavepoint implements CDOSavepoint
+public abstract class AbstractSavepoint implements CDOSavepoint
{
private CDOUserTransaction userTransaction;
- private CDOAbstractSavepoint previousSavepoint;
+ private AbstractSavepoint previousSavepoint;
- private CDOAbstractSavepoint nextSavepoint;
+ private AbstractSavepoint nextSavepoint;
- public CDOAbstractSavepoint(CDOUserTransaction transaction, CDOAbstractSavepoint lastSavepoint)
+ public AbstractSavepoint(CDOUserTransaction transaction, AbstractSavepoint lastSavepoint)
{
userTransaction = transaction;
previousSavepoint = lastSavepoint;
@@ -36,12 +36,12 @@ public abstract class CDOAbstractSavepoint implements CDOSavepoint
}
}
- public void setPreviousSavepoint(CDOAbstractSavepoint previousSavepoint)
+ public void setPreviousSavepoint(AbstractSavepoint previousSavepoint)
{
this.previousSavepoint = previousSavepoint;
}
- public void setNextSavepoint(CDOAbstractSavepoint nextSavepoint)
+ public void setNextSavepoint(AbstractSavepoint nextSavepoint)
{
this.nextSavepoint = nextSavepoint;
}
@@ -56,7 +56,7 @@ public abstract class CDOAbstractSavepoint implements CDOSavepoint
return previousSavepoint;
}
- public CDOAbstractSavepoint getFirstSavePoint()
+ public AbstractSavepoint getFirstSavePoint()
{
return previousSavepoint != null ? previousSavepoint.getFirstSavePoint() : this;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
index 9f3844baf3..c4822d7068 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java
@@ -39,7 +39,7 @@ import java.util.concurrent.ConcurrentMap;
* @author Simon McDuff
* @since 2.0
*/
-public class CDOSavepointImpl extends CDOAbstractSavepoint
+public class CDOSavepointImpl extends AbstractSavepoint
{
private Map<CDOID, CDOResource> newResources = new HashMap<CDOID, CDOResource>();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategy.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java
index e4b4a58d02..afc2bc7b8e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategy.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,24 +7,22 @@
*
* Contributors:
* Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
+ **************************************************************************/
package org.eclipse.emf.internal.cdo.transaction;
import org.eclipse.emf.cdo.transaction.CDOSavepoint;
import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol;
-import org.eclipse.emf.internal.cdo.protocol.CommitTransactionRequest;
-import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult;
import org.eclipse.net4j.util.om.monitor.EclipseMonitor;
+import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.transaction.TransactionException;
import org.eclipse.emf.spi.cdo.CDOTransactionStrategy;
-import org.eclipse.emf.spi.cdo.InternalCDOCommitContext;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
+import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -32,13 +30,14 @@ import org.eclipse.core.runtime.IProgressMonitor;
* @author Simon McDuff
* @since 2.0
*/
-public class CDOSingleTransactionStrategy implements CDOTransactionStrategy
+public class CDOSingleTransactionStrategyImpl implements CDOTransactionStrategy
{
- public static final CDOSingleTransactionStrategy INSTANCE = new CDOSingleTransactionStrategy();
+ public static final CDOSingleTransactionStrategyImpl INSTANCE = new CDOSingleTransactionStrategyImpl();
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_TRANSCTION, CDOSingleTransactionStrategy.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_TRANSCTION,
+ CDOSingleTransactionStrategyImpl.class);
- public CDOSingleTransactionStrategy()
+ public CDOSingleTransactionStrategyImpl()
{
}
@@ -51,27 +50,25 @@ public class CDOSingleTransactionStrategy implements CDOTransactionStrategy
}
commitContext.preCommit();
+
CommitTransactionResult result = null;
if (commitContext.getTransaction().isDirty())
{
- CDOClientProtocol protocol = (CDOClientProtocol)transaction.getSession().getProtocol();
- CommitTransactionRequest request = new CommitTransactionRequest(protocol, commitContext);
- if (TRACER.isEnabled())
- {
- TRACER.format("Sending commit request");
- }
+ OMMonitor monitor = new EclipseMonitor(progressMonitor);
+ result = transaction.getSession().getSessionProtocol().commitTransaction(commitContext, monitor);
- result = request.send(new EclipseMonitor(progressMonitor));
String rollbackMessage = result.getRollbackMessage();
if (rollbackMessage != null)
{
throw new TransactionException(rollbackMessage);
}
}
+
if (TRACER.isEnabled())
{
TRACER.format("CDOCommitContext.postCommit");
}
+
commitContext.postCommit(result);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index 3ac7eb00c0..35d9e2eb07 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -45,7 +45,6 @@ import org.eclipse.emf.cdo.view.CDOViewResourcesEvent;
import org.eclipse.emf.internal.cdo.CDOObjectMerger;
import org.eclipse.emf.internal.cdo.CDOStateMachine;
import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult;
import org.eclipse.emf.internal.cdo.session.CDOSessionPackageManagerImpl;
import org.eclipse.emf.internal.cdo.util.CompletePackageClosure;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
@@ -64,10 +63,10 @@ import org.eclipse.net4j.util.transaction.TransactionException;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.spi.cdo.CDOTransactionStrategy;
-import org.eclipse.emf.spi.cdo.InternalCDOCommitContext;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -129,7 +128,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
* @since 2.0
*/
@Override
- protected OptionsImpl initOptions()
+ protected OptionsImpl createOptions()
{
return new OptionsImpl();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionCommitContext.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
index cae57c1c89..b2aca39d28 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,13 +7,11 @@
*
* Contributors:
* Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
+ **************************************************************************/
package org.eclipse.emf.internal.cdo.transaction;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.model.CDOPackage;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
@@ -21,28 +19,28 @@ import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.internal.common.id.CDOIDExternalTempImpl;
import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult;
import org.eclipse.emf.internal.cdo.transaction.CDOXATransactionImpl.CDOXAState;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.spi.cdo.InternalCDOCommitContext;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
+import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
+import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
import org.eclipse.core.runtime.IProgressMonitor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.Callable;
/**
* @author Simon McDuff
* @since 2.0
*/
-public class CDOXATransactionCommitContext implements Callable<Object>, CDOIDProvider, InternalCDOCommitContext
+public class CDOXACommitContextImpl implements InternalCDOXACommitContext
{
private CDOXATransactionImpl transactionManager;
@@ -58,7 +56,7 @@ public class CDOXATransactionCommitContext implements Callable<Object>, CDOIDPro
private Map<InternalCDOObject, CDOIDExternalTempImpl> objectToID = new HashMap<InternalCDOObject, CDOIDExternalTempImpl>();
- public CDOXATransactionCommitContext(CDOXATransactionImpl manager, InternalCDOCommitContext commitContext)
+ public CDOXACommitContextImpl(CDOXATransactionImpl manager, InternalCDOCommitContext commitContext)
{
transactionManager = manager;
delegateCommitContext = commitContext;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepointImpl.java
index a4805694d3..575d258511 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepoint.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepointImpl.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,8 +7,7 @@
*
* Contributors:
* Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
+ **************************************************************************/
package org.eclipse.emf.internal.cdo.transaction;
import org.eclipse.emf.cdo.transaction.CDOSavepoint;
@@ -20,11 +19,11 @@ import java.util.List;
* @author Simon McDuff
* @since 2.0
*/
-public class CDOXASavepoint extends CDOAbstractSavepoint
+public class CDOXASavepointImpl extends AbstractSavepoint
{
private List<CDOSavepoint> savepoints;
- public CDOXASavepoint(CDOUserTransaction transaction, CDOAbstractSavepoint lastSavepoint)
+ public CDOXASavepointImpl(CDOUserTransaction transaction, AbstractSavepoint lastSavepoint)
{
super(transaction, lastSavepoint);
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 50414f70ed..a289e23416 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
@@ -19,24 +19,21 @@ import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.cdo.view.CDOViewSet;
-import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol;
-import org.eclipse.emf.internal.cdo.protocol.CommitTransactionCancelRequest;
-import org.eclipse.emf.internal.cdo.protocol.CommitTransactionPhase1Request;
-import org.eclipse.emf.internal.cdo.protocol.CommitTransactionPhase2Request;
-import org.eclipse.emf.internal.cdo.protocol.CommitTransactionPhase3Request;
-import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult;
-
import org.eclipse.net4j.util.CheckUtil;
import org.eclipse.net4j.util.om.monitor.EclipseMonitor;
+import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.monitor.EclipseMonitor.SynchonizedSubProgressMonitor;
import org.eclipse.net4j.util.transaction.TransactionException;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
import org.eclipse.emf.spi.cdo.CDOTransactionStrategy;
-import org.eclipse.emf.spi.cdo.InternalCDOCommitContext;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
+import org.eclipse.emf.spi.cdo.InternalCDOXATransaction;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
+import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -85,7 +82,7 @@ import java.util.concurrent.TimeoutException;
* @author Simon McDuff
* @since 2.0
*/
-public class CDOXATransactionImpl implements CDOXATransaction
+public class CDOXATransactionImpl implements InternalCDOXATransaction
{
private List<InternalCDOTransaction> transactions = new ArrayList<InternalCDOTransaction>();
@@ -93,13 +90,13 @@ public class CDOXATransactionImpl implements CDOXATransaction
private ExecutorService executorService = Executors.newFixedThreadPool(10);
- private Map<InternalCDOTransaction, CDOXATransactionCommitContext> activeContext = new HashMap<InternalCDOTransaction, CDOXATransactionCommitContext>();
+ private Map<InternalCDOTransaction, CDOXACommitContextImpl> activeContext = new HashMap<InternalCDOTransaction, CDOXACommitContextImpl>();
private Map<InternalCDOTransaction, Set<CDOID>> requestedCDOID = new HashMap<InternalCDOTransaction, Set<CDOID>>();
- private CDOXASavepoint lastSavepoint = new CDOXASavepoint(this, null);
+ private CDOXASavepointImpl lastSavepoint = new CDOXASavepointImpl(this, null);
- private CDOXASavepoint firstSavepoint = lastSavepoint;
+ private CDOXASavepointImpl firstSavepoint = lastSavepoint;
private CDOTransactionStrategy transactionStrategy = new CDOXATransactionStrategyImpl();
@@ -182,12 +179,12 @@ public class CDOXATransactionImpl implements CDOXATransaction
return ids.toArray(new CDOID[ids.size()]);
}
- public CDOXATransactionCommitContext getCommitContext(CDOTransaction transaction)
+ public CDOXACommitContextImpl getCommitContext(CDOTransaction transaction)
{
return activeContext.get(transaction);
}
- private void send(Collection<CDOXATransactionCommitContext> xaContexts, final IProgressMonitor progressMonitor)
+ private void send(Collection<CDOXACommitContextImpl> xaContexts, final IProgressMonitor progressMonitor)
throws InterruptedException, ExecutionException
{
progressMonitor.beginTask("", xaContexts.size());
@@ -195,7 +192,7 @@ public class CDOXATransactionImpl implements CDOXATransaction
try
{
List<Future<Object>> futures = new ArrayList<Future<Object>>();
- for (CDOXATransactionCommitContext xaContext : xaContexts)
+ for (CDOXACommitContextImpl xaContext : xaContexts)
{
xaContext.setProgressMonitor(new SynchonizedSubProgressMonitor(progressMonitor, 1));
futures.add(executorService.submit(xaContext));
@@ -221,7 +218,7 @@ public class CDOXATransactionImpl implements CDOXATransaction
finally
{
progressMonitor.done();
- for (CDOXATransactionCommitContext xaContext : xaContexts)
+ for (CDOXACommitContextImpl xaContext : xaContexts)
{
xaContext.setProgressMonitor(null);
}
@@ -262,7 +259,7 @@ public class CDOXATransactionImpl implements CDOXATransaction
for (InternalCDOTransaction transaction : transactions)
{
InternalCDOCommitContext context = transaction.createCommitContext();
- CDOXATransactionCommitContext xaContext = new CDOXATransactionCommitContext(this, context);
+ CDOXACommitContextImpl xaContext = new CDOXACommitContextImpl(this, context);
xaContext.setState(CDOXAPhase1State.INSTANCE);
activeContext.put(transaction, xaContext);
}
@@ -281,7 +278,7 @@ public class CDOXATransactionImpl implements CDOXATransaction
if (phase < 2)
{
// Phase 0 and 1 are the only two phases we can cancel.
- for (CDOXATransactionCommitContext transaction : activeContext.values())
+ for (CDOXACommitContextImpl transaction : activeContext.values())
{
transaction.setState(CDOXACancel.INSTANCE);
}
@@ -307,7 +304,7 @@ public class CDOXATransactionImpl implements CDOXATransaction
}
}
- public CDOXASavepoint getLastSavepoint()
+ public CDOXASavepointImpl getLastSavepoint()
{
return lastSavepoint;
}
@@ -334,7 +331,7 @@ public class CDOXATransactionImpl implements CDOXATransaction
throw new IllegalArgumentException("Savepoint isn't valid : " + savepoint);
}
- CDOXASavepoint savepointSet = (CDOXASavepoint)savepoint;
+ CDOXASavepointImpl savepointSet = (CDOXASavepointImpl)savepoint;
List<CDOSavepoint> savepoints = savepointSet.getSavepoints();
if (savepoints == null)
{
@@ -344,7 +341,7 @@ public class CDOXATransactionImpl implements CDOXATransaction
for (CDOSavepoint indexSavePoint : savepoints)
{
InternalCDOTransaction transaction = (InternalCDOTransaction)indexSavePoint.getUserTransaction();
- CDOSingleTransactionStrategy.INSTANCE.rollback(transaction, indexSavePoint);
+ CDOSingleTransactionStrategyImpl.INSTANCE.rollback(transaction, indexSavePoint);
}
lastSavepoint = savepointSet;
@@ -358,11 +355,11 @@ public class CDOXATransactionImpl implements CDOXATransaction
for (CDOSavepoint savepoint : savepoints)
{
InternalCDOTransaction transaction = (InternalCDOTransaction)savepoint.getUserTransaction();
- CDOSingleTransactionStrategy.INSTANCE.setSavepoint(transaction);
+ CDOSingleTransactionStrategyImpl.INSTANCE.setSavepoint(transaction);
}
getLastSavepoint().setSavepoints(savepoints);
- lastSavepoint = new CDOXASavepoint(this, getLastSavepoint());
+ lastSavepoint = new CDOXASavepointImpl(this, getLastSavepoint());
return lastSavepoint;
}
@@ -440,7 +437,7 @@ public class CDOXATransactionImpl implements CDOXATransaction
public static final CDOXAState DONE = new CDOXAState()
{
@Override
- protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception
+ protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception
{
progressMonitor.done();
}
@@ -454,8 +451,7 @@ public class CDOXATransactionImpl implements CDOXATransaction
}
}
- protected abstract void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor)
- throws Exception;
+ protected abstract void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception;
};
/**
@@ -466,18 +462,18 @@ public class CDOXATransactionImpl implements CDOXATransaction
public static final CDOXAPhase1State INSTANCE = new CDOXAPhase1State();
@Override
- protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception
+ protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception
{
xaContext.preCommit();
CommitTransactionResult result = null;
if (xaContext.getTransaction().isDirty())
{
- // Phase 1
- CDOClientProtocol protocol = (CDOClientProtocol)xaContext.getTransaction().getSession().getProtocol();
- CommitTransactionPhase1Request request = new CommitTransactionPhase1Request(protocol, xaContext);
- result = request.send(new EclipseMonitor(progressMonitor));
+ CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol();
+ OMMonitor monitor = new EclipseMonitor(progressMonitor);
+ result = sessionProtocol.commitTransactionPhase1(xaContext, monitor);
check_result(result);
}
+
xaContext.setResult(result);
xaContext.setState(CDOXAPhase2State.INSTANCE);
}
@@ -495,16 +491,16 @@ public class CDOXATransactionImpl implements CDOXATransaction
}
@Override
- protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception
+ protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception
{
if (xaContext.getTransaction().isDirty())
{
- // Phase 2
- CDOClientProtocol protocol = (CDOClientProtocol)xaContext.getTransaction().getSession().getProtocol();
- CommitTransactionPhase2Request request = new CommitTransactionPhase2Request(protocol, xaContext);
- CommitTransactionResult result = request.send(new EclipseMonitor(progressMonitor));
+ CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol();
+ OMMonitor monitor = new EclipseMonitor(progressMonitor);
+ CommitTransactionResult result = sessionProtocol.commitTransactionPhase2(xaContext, monitor);
check_result(result);
}
+
xaContext.setState(CDOXAPhase3State.INSTANCE);
}
};
@@ -521,14 +517,13 @@ public class CDOXATransactionImpl implements CDOXATransaction
}
@Override
- protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception
+ protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception
{
- // Phase 2
if (xaContext.getTransaction().isDirty())
{
- CDOClientProtocol protocol = (CDOClientProtocol)xaContext.getTransaction().getSession().getProtocol();
- CommitTransactionPhase3Request request = new CommitTransactionPhase3Request(protocol, xaContext);
- CommitTransactionResult result = request.send(new EclipseMonitor(progressMonitor));
+ CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol();
+ OMMonitor monitor = new EclipseMonitor(progressMonitor);
+ CommitTransactionResult result = sessionProtocol.commitTransactionPhase3(xaContext, monitor);
check_result(result);
}
xaContext.postCommit(xaContext.getResult());
@@ -548,12 +543,11 @@ public class CDOXATransactionImpl implements CDOXATransaction
}
@Override
- protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception
+ protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception
{
- // Phase 2
- CDOClientProtocol protocol = (CDOClientProtocol)xaContext.getTransaction().getSession().getProtocol();
- CommitTransactionCancelRequest request = new CommitTransactionCancelRequest(protocol, xaContext);
- CommitTransactionResult result = request.send(new EclipseMonitor(progressMonitor));
+ CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol();
+ OMMonitor monitor = new EclipseMonitor(progressMonitor);
+ CommitTransactionResult result = sessionProtocol.commitTransactionCancel(xaContext, monitor);
check_result(result);
}
};

Back to the top