summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-02-17 05:43:42 (EST)
committerEike Stepper2008-02-17 05:43:42 (EST)
commit11060de1eeb7eb3885a5399f967b8228939c52d3 (patch)
treef227117297abf7ebac94038307f39581b2c17da5
parent88a865a511dad813ca3df2adb4df6bbee65e81e9 (diff)
downloadcdo-11060de1eeb7eb3885a5399f967b8228939c52d3.zip
cdo-11060de1eeb7eb3885a5399f967b8228939c52d3.tar.gz
cdo-11060de1eeb7eb3885a5399f967b8228939c52d3.tar.bz2
[217117] Develop a HibernateStore
https://bugs.eclipse.org/bugs/show_bug.cgi?id=217117
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java62
2 files changed, 49 insertions, 39 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java
index 55befcc..bf956f2 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java
@@ -157,6 +157,12 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
return rollbackMessage;
}
+ public void preCommit()
+ {
+ storeWriter = repository.getStore().getWriter(this);
+ StoreUtil.setReader(storeWriter);
+ }
+
public void commit(CDOPackage[] newPackages, CDORevision[] newObjects, CDORevisionDelta[] dirtyObjectDeltas)
{
timeStamp = System.currentTimeMillis();
@@ -165,9 +171,6 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
this.dirtyObjectDeltas = dirtyObjectDeltas;
dirtyObjects = new CDORevision[dirtyObjectDeltas.length];
- storeWriter = repository.getStore().getWriter(this);
- StoreUtil.setReader(storeWriter);
-
try
{
adjustMetaRanges();
@@ -183,15 +186,6 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
rollbackMessage = ex.getMessage();
rollback();
}
- finally
- {
- if (storeWriter != null)
- {
- StoreUtil.setReader(null);
- storeWriter.release();
- storeWriter = null;
- }
- }
}
public void postCommit(boolean success)
@@ -213,6 +207,14 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
}
finally
{
+ // TODO Do this while indcating instead of responding
+ if (storeWriter != null)
+ {
+ StoreUtil.setReader(null);
+ storeWriter.release();
+ storeWriter = null;
+ }
+
timeStamp = 0L;
packageManager.clear();
metaIDRanges.clear();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
index aabbfc9..2469731 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
@@ -65,8 +65,9 @@ public class CommitTransactionIndication extends CDOServerIndication
int viewID = in.readInt();
transaction = getTransaction(viewID);
- TransactionPackageManager packageManager = transaction.getPackageManager();
+ transaction.preCommit();
+ TransactionPackageManager packageManager = transaction.getPackageManager();
CDOPackage[] newPackages = new CDOPackage[in.readInt()];
CDORevision[] newObjects = new CDORevision[in.readInt()];
CDORevisionDelta[] dirtyObjectDeltas = new CDORevisionDelta[in.readInt()];
@@ -111,41 +112,48 @@ public class CommitTransactionIndication extends CDOServerIndication
@Override
protected void responding(ExtendedDataOutputStream out) throws IOException
{
- String rollbackMessage = transaction.getRollbackMessage();
- boolean success = rollbackMessage == null;
- out.writeBoolean(success);
- if (success)
- {
- out.writeLong(transaction.getTimeStamp());
+ boolean success = false;
- // Meta ID ranges
- List<CDOIDMetaRange> metaRanges = transaction.getMetaIDRanges();
- for (CDOIDMetaRange metaRange : metaRanges)
+ try
+ {
+ String rollbackMessage = transaction.getRollbackMessage();
+ success = rollbackMessage == null;
+ out.writeBoolean(success);
+ if (success)
{
- CDOIDUtil.writeMetaRange(out, metaRange);
- }
+ out.writeLong(transaction.getTimeStamp());
- // ID mappings
- Map<CDOIDTemp, CDOID> idMappings = transaction.getIDMappings();
- for (Entry<CDOIDTemp, CDOID> entry : idMappings.entrySet())
- {
- CDOIDTemp oldID = entry.getKey();
- if (!oldID.isMeta())
+ // Meta ID ranges
+ List<CDOIDMetaRange> metaRanges = transaction.getMetaIDRanges();
+ for (CDOIDMetaRange metaRange : metaRanges)
{
- CDOID newID = entry.getValue();
- CDOIDUtil.write(out, oldID);
- CDOIDUtil.write(out, newID);
+ CDOIDUtil.writeMetaRange(out, metaRange);
}
- }
- CDOIDUtil.write(out, CDOID.NULL);
+ // ID mappings
+ Map<CDOIDTemp, CDOID> idMappings = transaction.getIDMappings();
+ for (Entry<CDOIDTemp, CDOID> entry : idMappings.entrySet())
+ {
+ CDOIDTemp oldID = entry.getKey();
+ if (!oldID.isMeta())
+ {
+ CDOID newID = entry.getValue();
+ CDOIDUtil.write(out, oldID);
+ CDOIDUtil.write(out, newID);
+ }
+ }
+
+ CDOIDUtil.write(out, CDOID.NULL);
+ }
+ else
+ {
+ out.writeString(rollbackMessage);
+ }
}
- else
+ finally
{
- out.writeString(rollbackMessage);
+ transaction.postCommit(success);
}
-
- transaction.postCommit(success);
}
private Transaction getTransaction(int viewID)