Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / iapi / store / raw / xact / TransactionFactory.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/iapi/store/raw/xact/TransactionFactory.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/iapi/store/raw/xact/TransactionFactory.java
new file mode 100644 (file)
index 0000000..3e7323e
--- /dev/null
@@ -0,0 +1,334 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.iapi.store.raw.xact.TransactionFactory\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.iapi.store.raw.xact;\r
+\r
+import org.apache.derby.iapi.services.context.ContextManager;\r
+import org.apache.derby.iapi.services.daemon.Serviceable;\r
+import org.apache.derby.iapi.services.io.Formatable;\r
+import org.apache.derby.iapi.services.locks.CompatibilitySpace;\r
+import org.apache.derby.iapi.services.locks.LockFactory;\r
+\r
+import org.apache.derby.iapi.store.access.TransactionInfo;\r
+\r
+import org.apache.derby.iapi.store.raw.RawStoreFactory;\r
+import org.apache.derby.iapi.store.raw.Transaction;\r
+import org.apache.derby.iapi.store.raw.Corruptable;\r
+\r
+import org.apache.derby.iapi.store.raw.log.LogInstant;\r
+\r
+import org.apache.derby.iapi.error.StandardException;\r
+\r
+/**\r
+       This module is intended to be used only within the RawStore. RawStore functionality\r
+       is accessed only through the RawStoreFactory interface.\r
+       The transaction manager is responsible for:\r
+\r
+       <UL>\r
+       <LI>Generating unique transaction identifiers.\r
+       <LI>Keeping a list of all open transactions within the raw store.\r
+       </UL>\r
+\r
+       @see RawStoreFactory\r
+       @see Transaction\r
+*/\r
+\r
+public interface TransactionFactory extends Corruptable {\r
+\r
+       public static String MODULE =\r
+        "org.apache.derby.iapi.store.raw.xact.TransactionFactory";\r
+\r
+       /**\r
+               Get the LockFactory to use with this store.\r
+       */\r
+       public LockFactory getLockFactory();\r
+\r
+       /**\r
+        * Return the module providing XAresource interface to the transaction\r
+     * table.\r
+     *\r
+        * @exception StandardException Standard Derby exception policy.\r
+        */\r
+       public /* XAResourceManager */ Object getXAResourceManager()\r
+        throws StandardException;\r
+\r
+       /**\r
+               Start a new transaction within the given raw store. This method will\r
+        push a transaction context as described in\r
+        RawStoreFactory.startTransaction\r
+\r
+        @param contextMgr is the context manager to use.  It must be the current\r
+                          context manager.\r
+        @param transName is the transaction name. It will be displayed in the\r
+            transactiontable VTI.\r
+\r
+               @see RawStoreFactory#startTransaction\r
+\r
+               @exception StandardException Standard Derby error policy.\r
+       */\r
+       public RawTransaction startTransaction(\r
+    RawStoreFactory rsf,\r
+    ContextManager  contextMgr,\r
+    String transName)\r
+        throws StandardException;\r
+\r
+       /**\r
+               Start a new read only transaction within the given raw store. This \r
+        method will push a transaction context as described in\r
+        RawStoreFactory.startNestedTransaction\r
+\r
+               @param compatibilitySpace   compatibility space to use for locks.\r
+        @param contextMgr           is the context manager to use.  It must be \r
+                                    the current context manager.\r
+        @param transName            is the transaction name. It will be \r
+                                    displayed in the transactiontable VTI.\r
+\r
+               @see RawStoreFactory#startNestedReadOnlyUserTransaction\r
+\r
+               @exception StandardException Standard Derby error policy.\r
+       */\r
+       public RawTransaction startNestedReadOnlyUserTransaction(\r
+    RawStoreFactory rsf,\r
+    CompatibilitySpace compatibilitySpace,\r
+    ContextManager  contextMgr,\r
+    String          transName)\r
+        throws StandardException;\r
+\r
+       /**\r
+               Start a new update transaction within the given raw store. This method \r
+        will push a transaction context as described in\r
+        RawStoreFactory.startNestedTransaction\r
+\r
+        @param contextMgr           is the context manager to use.  It must be \r
+                                    the current context manager.\r
+        @param transName            is the transaction name. It will be \r
+                                    displayed in the transactiontable VTI.\r
+\r
+               @see RawStoreFactory#startNestedUpdateUserTransaction\r
+\r
+               @exception StandardException Standard Derby error policy.\r
+       */\r
+       public RawTransaction startNestedUpdateUserTransaction(\r
+    RawStoreFactory rsf,\r
+    ContextManager  contextMgr,\r
+    String          transName)\r
+        throws StandardException;\r
+\r
+\r
+       /**\r
+               Start a new transaction within the given raw store. This method will\r
+        push a transaction context as described in\r
+        RawStoreFactory.startTransaction\r
+\r
+        @param format_id  the format id part of the Xid - ie. Xid.getFormatId().\r
+        @param global_id  the global transaction identifier part of XID - ie.\r
+                          Xid.getGlobalTransactionId().\r
+        @param branch_id  The branch qualifier of the Xid - ie.\r
+                          Xid.getBranchQaulifier()\r
+        @param contextMgr is the context manager to use.  It must be the current\r
+                          context manager.\r
+\r
+               @see RawStoreFactory#startGlobalTransaction\r
+\r
+               @exception StandardException Standard Derby error policy.\r
+       */\r
+       public RawTransaction startGlobalTransaction(\r
+    RawStoreFactory rsf,\r
+    ContextManager  contextMgr, \r
+    int             format_id,\r
+    byte[]          global_id,\r
+    byte[]          branch_id)\r
+        throws StandardException;\r
+\r
+       /**\r
+               Find a user transaction within the given raw store and the given\r
+               contextMgr.  If no user transaction exist, then start one with name\r
+        transName. This method will push a transaction context as described in\r
+               RawStoreFactory.startTransaction\r
+\r
+               @see RawStoreFactory#findUserTransaction\r
+               @see RawStoreFactory#startTransaction\r
+\r
+               @exception StandardException Standard Derby error policy.\r
+       */\r
+       public RawTransaction findUserTransaction(\r
+        RawStoreFactory rsf,\r
+        ContextManager contextMgr,\r
+        String transName) throws StandardException;\r
+\r
+       /**\r
+               Start a new nested top transaction within the given raw store. This\r
+        method will push a transaction context as described in\r
+        RawStoreFactory.startNestedTopTransaction\r
+\r
+               @see RawStoreFactory#startTransaction(ContextManager, String)\r
+\r
+               @exception StandardException Standard Derby error policy.\r
+       */\r
+       public RawTransaction startNestedTopTransaction(RawStoreFactory rsf, ContextManager contextMgr) throws StandardException;\r
+\r
+\r
+       /**\r
+               Start a new internal transaction within the given raw store. This \r
+        method will push a transaction context as described in \r
+        RawStoreFactory.startInternalTransaction\r
+\r
+               @see RawStoreFactory#startTransaction\r
+\r
+               @exception StandardException Standard Derby error policy.\r
+       */\r
+       public RawTransaction startInternalTransaction(RawStoreFactory rsf, ContextManager contextMgr) throws StandardException;\r
+\r
+\r
+       /**\r
+               Find a transaction using a transactionId and make the passed in\r
+               transaction assume the identity and properties of that transaction.\r
+               Used in recovery only.\r
+       */\r
+       public boolean findTransaction(TransactionId id, RawTransaction tran);\r
+\r
+\r
+       /**\r
+               Reset any resettable transaction Id \r
+               @exception StandardException Standard Derby error policy.\r
+       */\r
+       public void resetTranId() throws StandardException;\r
+\r
+       /**\r
+               The first log instant that belongs to a transaction that is still\r
+               active in the raw store. This is the first log record of the longest\r
+               running transaction at this moment. \r
+       */\r
+       public LogInstant firstUpdateInstant();\r
+\r
+       /**\r
+        Run through all prepared transactions known to this factory \r
+        and restore their state such that they remain after recovery, and\r
+        can be found and handled by a XA transaction manager.  This includes\r
+        creating a context manager for each, pushing a xact context, and\r
+        reclaiming update locks on all data changed by the transaction.\r
+\r
+               Used only in recovery.\r
+\r
+               @exception StandardException Derby Standard Error policy\r
+       */\r
+       public void handlePreparedXacts(\r
+    RawStoreFactory rsf)\r
+                throws StandardException;\r
+\r
+\r
+       /**\r
+               Rollback and close all transactions known to this factory using a\r
+               passed in transaction.  Used only in recovery.\r
+\r
+               @param recoveryTransaction the transaction used to rollback\r
+               @exception StandardException Derby Standard Error policy\r
+       */\r
+       public void rollbackAllTransactions(RawTransaction recoveryTransaction, \r
+                                                                               RawStoreFactory rsf)\r
+                throws StandardException ;\r
+\r
+\r
+       /**\r
+               Submit a post commit work to the post commit daemon.\r
+               The work is always added to the deamon, regardless of the\r
+               state it returns.\r
+\r
+               @return true if the daemon indicates it is being overloaded,\r
+               false it's happy.\r
+\r
+               <MT> must be MT-safe\r
+       */\r
+       public boolean submitPostCommitWork(Serviceable work);\r
+\r
+       /**\r
+               make Transaction factory aware of which raw store factory it belongs to\r
+       */\r
+       public void setRawStoreFactory(RawStoreFactory rsf) throws StandardException;\r
+\r
+       /**\r
+               Returns true if the transaction factory has no active updating \r
+        transaction\r
+       */\r
+       public boolean noActiveUpdateTransaction();\r
+\r
+\r
+    /**\r
+     * Check if there are any prepared transanctions.\r
+     *\r
+     * <P>MT - unsafe, called during boot, which is single threaded.\r
+     *\r
+     * @return   <tt>true</tt> if prepared transactions exist,\r
+     *                  <tt>false</tt> otherwise.\r
+     */\r
+       public boolean hasPreparedXact();\r
+\r
+       /**\r
+               Database creation finished\r
+\r
+               @exception StandardException Standard Derby exception policy.\r
+       */\r
+       public void createFinished() throws StandardException;\r
+\r
+       /**\r
+               Return the transaction table so it can get logged with the checkpoint\r
+               log record.\r
+        */\r
+       public Formatable getTransactionTable();\r
+\r
+       /**\r
+               Use this transaction table, which is gotten from a checkpoint\r
+               operation.  Use ONLY during recovery.\r
+\r
+               @exception StandardException Standard Derby exception policy.\r
+        */\r
+       public void useTransactionTable(Formatable transactionTable) \r
+                throws StandardException; \r
+\r
+       /**\r
+         @see org.apache.derby.iapi.store.access.AccessFactory#getTransactionInfo\r
+        */\r
+       public TransactionInfo[] getTransactionInfo();\r
+\r
+\r
+       /**\r
+        * Checks if there any backup blocking operations are in progress and \r
+        * prevents new ones from starting until the backup is finished. \r
+        *\r
+        * @param wait if <tt>true</tt>, waits for the current backup blocking \r
+        *             operations in progress to finish.\r
+        * @return     <tt>true</tt> if there are no backup blocking \r
+        *             operations in progress.\r
+        *             <tt>false</tt> otherwise.\r
+        * @exception StandardException if interrupted or a runtime exception occurs.\r
+        */\r
+       public boolean blockBackupBlockingOperations(boolean wait) \r
+               throws StandardException ;\r
+\r
+       /**\r
+        * Backup completed. Allow backup blocking operations. \r
+        */\r
+       public void  unblockBackupBlockingOperations();\r
+\r
+                                                                                                          \r
+\r
+                                                                                                          \r
+}\r