Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.doc/javadoc/org/eclipse/emf/cdo/transaction/CDOUserTransaction.html')
-rw-r--r--plugins/org.eclipse.emf.cdo.doc/javadoc/org/eclipse/emf/cdo/transaction/CDOUserTransaction.html62
1 files changed, 58 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.doc/javadoc/org/eclipse/emf/cdo/transaction/CDOUserTransaction.html b/plugins/org.eclipse.emf.cdo.doc/javadoc/org/eclipse/emf/cdo/transaction/CDOUserTransaction.html
index 431dfdd85b..77b64bb6ea 100644
--- a/plugins/org.eclipse.emf.cdo.doc/javadoc/org/eclipse/emf/cdo/transaction/CDOUserTransaction.html
+++ b/plugins/org.eclipse.emf.cdo.doc/javadoc/org/eclipse/emf/cdo/transaction/CDOUserTransaction.html
@@ -144,7 +144,7 @@ Provides functionality that is common to both <A HREF="../../../../../org/eclips
<TD><CODE><B><A HREF="../../../../../org/eclipse/emf/cdo/transaction/CDOUserTransaction.html#commit()">commit</A></B>()</CODE>
<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Same as <A HREF="../../../../../org/eclipse/emf/cdo/transaction/CDOUserTransaction.html#commit(org.eclipse.core.runtime.IProgressMonitor)"><CODE>commit(null)</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -152,7 +152,7 @@ Provides functionality that is common to both <A HREF="../../../../../org/eclips
<TD><CODE><B><A HREF="../../../../../org/eclipse/emf/cdo/transaction/CDOUserTransaction.html#commit(org.eclipse.core.runtime.IProgressMonitor)">commit</A></B>(<A HREF="http://help.eclipse.org/topic//org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/runtime/IProgressMonitor.html?is-external=true" title="class or interface in org.eclipse.core.runtime">IProgressMonitor</A>&nbsp;progressMonitor)</CODE>
<BR>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Commits the modifications of this transaction to the repository and returns a <A HREF="../../../../../org/eclipse/emf/cdo/common/commit/CDOCommitInfo.html" title="interface in org.eclipse.emf.cdo.common.commit"><CODE>commit info</CODE></A> object if successful.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
@@ -198,11 +198,15 @@ Provides functionality that is common to both <A HREF="../../../../../org/eclips
commit</H3>
<PRE>
<A HREF="../../../../../org/eclipse/emf/cdo/common/commit/CDOCommitInfo.html" title="interface in org.eclipse.emf.cdo.common.commit">CDOCommitInfo</A> <B>commit</B>()
- throws <A HREF="../../../../../org/eclipse/emf/cdo/util/CommitException.html" title="class in org.eclipse.emf.cdo.util">CommitException</A></PRE>
+ throws <A HREF="../../../../../org/eclipse/emf/cdo/util/ConcurrentAccessException.html" title="class in org.eclipse.emf.cdo.util">ConcurrentAccessException</A>,
+ <A HREF="../../../../../org/eclipse/emf/cdo/util/CommitException.html" title="class in org.eclipse.emf.cdo.util">CommitException</A></PRE>
<DL>
+<DD>Same as <A HREF="../../../../../org/eclipse/emf/cdo/transaction/CDOUserTransaction.html#commit(org.eclipse.core.runtime.IProgressMonitor)"><CODE>commit(null)</CODE></A>.
+<P>
<DD><DL>
<DT><B>Throws:</B>
+<DD><CODE><A HREF="../../../../../org/eclipse/emf/cdo/util/ConcurrentAccessException.html" title="class in org.eclipse.emf.cdo.util">ConcurrentAccessException</A></CODE>
<DD><CODE><A HREF="../../../../../org/eclipse/emf/cdo/util/CommitException.html" title="class in org.eclipse.emf.cdo.util">CommitException</A></CODE><DT><B>Since:</B></DT>
<DD>3.0</DD>
</DL>
@@ -214,11 +218,61 @@ commit</H3>
commit</H3>
<PRE>
<A HREF="../../../../../org/eclipse/emf/cdo/common/commit/CDOCommitInfo.html" title="interface in org.eclipse.emf.cdo.common.commit">CDOCommitInfo</A> <B>commit</B>(<A HREF="http://help.eclipse.org/topic//org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/runtime/IProgressMonitor.html?is-external=true" title="class or interface in org.eclipse.core.runtime">IProgressMonitor</A>&nbsp;progressMonitor)
- throws <A HREF="../../../../../org/eclipse/emf/cdo/util/CommitException.html" title="class in org.eclipse.emf.cdo.util">CommitException</A></PRE>
+ throws <A HREF="../../../../../org/eclipse/emf/cdo/util/ConcurrentAccessException.html" title="class in org.eclipse.emf.cdo.util">ConcurrentAccessException</A>,
+ <A HREF="../../../../../org/eclipse/emf/cdo/util/CommitException.html" title="class in org.eclipse.emf.cdo.util">CommitException</A></PRE>
<DL>
+<DD>Commits the modifications of this transaction to the repository and returns a <A HREF="../../../../../org/eclipse/emf/cdo/common/commit/CDOCommitInfo.html" title="interface in org.eclipse.emf.cdo.common.commit"><CODE>commit info</CODE></A> object if successful.
+ <p>
+ Various kinds of problems <b>can</b> cause the commit to fail and not all of them can be avoided by acquiring pessimistic <A HREF="../../../../../org/eclipse/emf/cdo/CDOObject.html#cdoWriteLock()"><CODE>locks</CODE></A>
+ on the modified objects. In particular you <b>must</b> expect and handle <A HREF="../../../../../org/eclipse/emf/cdo/util/ContainmentCycleException.html" title="class in org.eclipse.emf.cdo.util"><CODE>containment cycle exceptions</CODE></A>. The following example shows how
+ write robust transactions:
+ <pre>
+ CDOTransaction transaction = null;
+
+ try
+ {
+ transaction = session.openTransaction();
+
+ for (;;)
+ {
+ try
+ {
+ synchronized (transaction)
+ {
+ CDOResource resource = transaction.getResource("/stock/resource1");
+
+ // Modify the model here...
+
+ transaction.commit();
+ break;
+ }
+ }
+ catch (ConcurrentAccessException ex)
+ {
+ transaction.rollback();
+ }
+ catch (CommitException ex)
+ {
+ throw ex.wrap();
+ }
+ }
+ }
+ finally
+ {
+ if (transaction != null)
+ {
+ transaction.close();
+ }
+ }
+ </pre>
+
+ Note that the transaction stays functional after a any call to the <code>commit()</code> methods. If the transaction is not closed after a commit
+ it can be used to apply additional modifications to the model.
+<P>
<DD><DL>
<DT><B>Throws:</B>
+<DD><CODE><A HREF="../../../../../org/eclipse/emf/cdo/util/ConcurrentAccessException.html" title="class in org.eclipse.emf.cdo.util">ConcurrentAccessException</A></CODE>
<DD><CODE><A HREF="../../../../../org/eclipse/emf/cdo/util/CommitException.html" title="class in org.eclipse.emf.cdo.util">CommitException</A></CODE><DT><B>Since:</B></DT>
<DD>3.0</DD>
</DL>

Back to the top