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