]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/service/TransactionPolicySupport.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / service / TransactionPolicySupport.java
diff --git a/bundles/org.simantics.db/src/org/simantics/db/service/TransactionPolicySupport.java b/bundles/org.simantics.db/src/org/simantics/db/service/TransactionPolicySupport.java
new file mode 100644 (file)
index 0000000..6b59b05
--- /dev/null
@@ -0,0 +1,65 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.db.service;\r
+\r
+\r
+\r
+public interface TransactionPolicySupport {\r
+    \r
+    /**\r
+     * Called when read transaction ends to decide if client should release\r
+     * the transaction. \r
+     * \r
+     * @return true if you want to keep the transaction. \r
+     */\r
+    boolean holdOnToTransactionAfterRead();\r
+\r
+    /**\r
+     * Called when transaction is cancelled to decide if client should release\r
+     * the transaction.\r
+     * \r
+     * @return true if you want to keep the transaction. \r
+     */\r
+    boolean holdOnToTransactionAfterCancel();\r
+\r
+    /**\r
+     * Called when write transaction ends to decided if client should release\r
+     * the transaction. \r
+     * \r
+     * @return true if you want to keep the transaction. \r
+     */\r
+    boolean holdOnToTransactionAfterCommit();\r
+\r
+    /**\r
+     * Called when server asks us to relinquish the transaction. This should\r
+     * trigger the end of ongoing requests. The caller (and server) will wait\r
+     * until the requests are ended and the transaction is freed. You have to\r
+     * end the requests during the call. If you do then onRelinquishDone is\r
+     * called and you can ask for a transaction again. If you do not then the\r
+     * connection is closed and all uncommitted work is lost. After connection\r
+     * is closed onRelinquishError is called giving you a chance to clean up the\r
+     * mess.\r
+     */\r
+    void onRelinquish();\r
+\r
+    /**\r
+     * Called after server has been sent the reply to relinquish message. This\r
+     * means that you can ask transaction again.\r
+     */\r
+    void onRelinquishDone();\r
+\r
+    /**\r
+     * Called after onRelinquish has failed to end requests. This means that the\r
+     * connection has been closed and all uncommitted work has been lost.\r
+     */\r
+    void onRelinquishError();\r
+}\r