]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db.service;\r
13 \r
14 \r
15 \r
16 public interface TransactionPolicySupport {\r
17     \r
18     /**\r
19      * Called when read transaction ends to decide if client should release\r
20      * the transaction. \r
21      * \r
22      * @return true if you want to keep the transaction. \r
23      */\r
24     boolean holdOnToTransactionAfterRead();\r
25 \r
26     /**\r
27      * Called when transaction is cancelled to decide if client should release\r
28      * the transaction.\r
29      * \r
30      * @return true if you want to keep the transaction. \r
31      */\r
32     boolean holdOnToTransactionAfterCancel();\r
33 \r
34     /**\r
35      * Called when write transaction ends to decided if client should release\r
36      * the transaction. \r
37      * \r
38      * @return true if you want to keep the transaction. \r
39      */\r
40     boolean holdOnToTransactionAfterCommit();\r
41 \r
42     /**\r
43      * Called when server asks us to relinquish the transaction. This should\r
44      * trigger the end of ongoing requests. The caller (and server) will wait\r
45      * until the requests are ended and the transaction is freed. You have to\r
46      * end the requests during the call. If you do then onRelinquishDone is\r
47      * called and you can ask for a transaction again. If you do not then the\r
48      * connection is closed and all uncommitted work is lost. After connection\r
49      * is closed onRelinquishError is called giving you a chance to clean up the\r
50      * mess.\r
51      */\r
52     void onRelinquish();\r
53 \r
54     /**\r
55      * Called after server has been sent the reply to relinquish message. This\r
56      * means that you can ask transaction again.\r
57      */\r
58     void onRelinquishDone();\r
59 \r
60     /**\r
61      * Called after onRelinquish has failed to end requests. This means that the\r
62      * connection has been closed and all uncommitted work has been lost.\r
63      */\r
64     void onRelinquishError();\r
65 }\r