KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > store > access > conglomerate > TransactionManager


1 /*
2
3    Derby - Class org.apache.derby.iapi.store.access.conglomerate.TransactionManager
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.store.access.conglomerate;
23
24 import org.apache.derby.iapi.services.daemon.Serviceable;
25 import org.apache.derby.iapi.store.access.AccessFactory;
26 import org.apache.derby.iapi.store.access.ConglomerateController;
27 import org.apache.derby.iapi.store.access.SortController;
28 import org.apache.derby.iapi.store.access.TransactionController;
29 import org.apache.derby.iapi.store.raw.LockingPolicy;
30 import org.apache.derby.iapi.store.raw.Page;
31 import org.apache.derby.iapi.store.raw.Transaction;
32 import org.apache.derby.iapi.error.StandardException;
33
34
35 /**
36
37 The TransactionManager interface provides methods on the transaction needed
38 by an access method implementer, but should not be visible to clients of a
39 TransactionController.
40 <p>
41 @see TransactionController
42
43 **/

44
45 public interface TransactionManager extends TransactionController
46 {
47
48     /**
49      * Constant used for the lock_level argument to openConglomerate() and
50      * openScan() calls. Pass in MODE_NONE if you want no table or row locks.
51      * This is currently only supported from within access.
52      **/

53     static final int MODE_NONE = 5;
54
55     /**
56      * release lock immediately after getting lock.
57      **/

58     public static final int LOCK_INSTANT_DURATION = 1;
59     /**
60      * hold lock until end of transaction.
61      **/

62     public static final int LOCK_COMMIT_DURATION = 2;
63     /**
64      * Allow lock to be released manually prior to end transaction.
65      **/

66     public static final int LOCK_MANUAL_DURATION = 3;
67
68     /**
69      * Add to the list of post commit work.
70      * <p>
71      * Add to the list of post commit work that may be processed after this
72      * transaction commits. If this transaction aborts, then the post commit
73      * work list will be thrown away. No post commit work will be taken out
74      * on a rollback to save point.
75      * <p>
76      * This routine simply delegates the work to the Rawstore transaction.
77      *
78      * @param work The post commit work to do.
79      *
80      **/

81     public void addPostCommitWork(Serviceable work);
82
83     /**
84      * The ScanManager.close() method has been called on "scan".
85      * <p>
86      * Take whatever cleanup action is appropriate to a closed scan. It is
87      * likely this routine will remove references to the scan object that it
88      * was maintaining for cleanup purposes.
89      *
90      **/

91     public void closeMe(ScanManager scan);
92
93     /**
94      * The ConglomerateController.close() method has been called on
95      * "conglom_control".
96      * <p>
97      * Take whatever cleanup action is appropriate to a closed
98      * conglomerateController. It is likely this routine will remove
99      * references to the ConglomerateController object that it was maintaining
100      * for cleanup purposes.
101      **/

102     public void closeMe(ConglomerateController conglom_control);
103
104     /**
105      * The SortController.close() method has been called on "sort_control".
106      * <p>
107      * Take whatever cleanup action is appropriate to a closed
108      * sortController. It is likely this routine will remove
109      * references to the SortController object that it was maintaining
110      * for cleanup purposes.
111      **/

112     public void closeMe(SortController sort_control);
113
114     /**
115      * Get reference to access factory which started this transaction.
116      * <p>
117      *
118      * @return The AccessFactory which started this transaction.
119      **/

120     public AccessFactory getAccessManager();
121
122     /**
123      * Get an Internal transaction.
124      * <p>
125      * Start an internal transaction. An internal transaction is a completely
126      * separate transaction from the current user transaction. All work done
127      * in the internal transaction must be physical (ie. it can be undone
128      * physically by the rawstore at the page level, rather than logically
129      * undone like btree insert/delete operations). The rawstore guarantee's
130      * that in the case of a system failure all open Internal transactions are
131      * first undone in reverse order, and then other transactions are undone
132      * in reverse order.
133      * <p>
134      * Internal transactions are meant to implement operations which, if
135      * interupted before completion will cause logical operations like tree
136      * searches to fail. This special undo order insures that the state of
137      * the tree is restored to a consistent state before any logical undo
138      * operation which may need to search the tree is performed.
139      * <p>
140      *
141      * @return The new internal transaction.
142      *
143      * @exception StandardException Standard exception policy.
144      **/

145     public TransactionManager getInternalTransaction()
146         throws StandardException;
147
148     /**
149      * Get the Transaction from the Transaction manager.
150      * <p>
151      * Access methods often need direct access to the "Transaction" - ie. the
152      * raw store transaction, so give access to it.
153      *
154      * @return The raw store transaction.
155      *
156      * @exception StandardException Standard exception policy.
157      **/

158     public Transaction getRawStoreXact()
159         throws StandardException;
160
161     /**
162      * Do work necessary to maintain the current position in all the scans.
163      * <p>
164      * The latched page in the conglomerate "congomid" is changing, do
165      * whatever is necessary to maintain the current position of all the
166      * scans open in this transaction.
167      * <p>
168      * For some conglomerates this may be a no-op.
169      * <p>
170      *
171      * @param conglom Conglomerate object of the conglomerate being changed.
172      * @param page Page in the conglomerate being changed.
173      *
174      * @exception StandardException Standard exception policy.
175      **/

176     public void saveScanPositions(Conglomerate conglom, Page page)
177         throws StandardException;
178 }
179
Popular Tags