001/* 002 * JKNIV, whinstone one contract to access your database. 003 * 004 * Copyright (C) 2017, the original author or authors. 005 * 006 * This library is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 2.1 of the License. 010 * 011 * This library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with this library; if not, write to the Free Software Foundation, Inc., 018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 019 */ 020package net.sf.jkniv.whinstone.transaction; 021 022/** 023 * The Status interface defines static variables used for transaction 024 * status codes. 025 */ 026public enum TransactionStatus 027{ 028 /** 029 * A transaction is associated with the target object and it is in the 030 * active state. An implementation returns this status after a 031 * transaction has been started and prior to a Coordinator issuing 032 * any prepares, unless the transaction has been marked for rollback. 033 */ 034 ACTIVE { 035 public int value() { return 0; } 036 }, 037 038 /** 039 * A transaction is associated with the target object and it has been 040 * marked for rollback, perhaps as a result of a setRollbackOnly operation. 041 */ 042 MARKED_ROLLBACK { 043 public int value() { return 1; } 044 }, 045 046 /** 047 * A transaction is associated with the target object and it has been 048 * prepared. That is, all subordinates have agreed to commit. The 049 * target object may be waiting for instructions from a superior as to how 050 * to proceed. 051 */ 052 PREPARED { 053 public int value() { return 2; } 054 }, 055 056 /** 057 * A transaction is associated with the target object and it has been 058 * committed. It is likely that heuristics exist; otherwise, the 059 * transaction would have been destroyed and NoTransaction returned. 060 */ 061 COMMITTED { 062 public int value() { return 3; } 063 }, 064 065 /** 066 * A transaction is associated with the target object and the outcome 067 * has been determined to be rollback. It is likely that heuristics exist; 068 * otherwise, the transaction would have been destroyed and NoTransaction 069 * returned. 070 */ 071 ROLLEDBACK { 072 public int value() { return 4; } 073 }, 074 075 /** 076 * A transaction is associated with the target object but its 077 * current status cannot be determined. This is a transient condition 078 * and a subsequent invocation will ultimately return a different status. 079 */ 080 UNKNOWN { 081 public int value() { return 5; } 082 }, 083 084 /** 085 * No transaction is currently associated with the target object. This 086 * will occur after a transaction has completed. 087 */ 088 NO_TRANSACTION { 089 public int value() {return 6; } 090 }, 091 092 /** 093 * A transaction is associated with the target object and it is in the 094 * process of preparing. An implementation returns this status if it 095 * has started preparing, but has not yet completed the process. The 096 * likely reason for this is that the implementation is probably 097 * waiting for responses to prepare from one or more Resources. 098 */ 099 PREPARING { 100 public int value() { return 7; } 101 }, 102 103 /** 104 * A transaction is associated with the target object and it is in the 105 * process of committing. An implementation returns this status if it 106 * has decided to commit but has not yet completed the committing process. 107 * This occurs because the implementation is probably waiting for 108 * responses from one or more Resources. 109 */ 110 COMMITTING { 111 public int value() { return 8; } 112 }, 113 114 /** 115 * A transaction is associated with the target object and it is in the 116 * process of rolling back. An implementation returns this status if 117 * it has decided to rollback but has not yet completed the process. 118 * The implementation is probably waiting for responses from one or more 119 * Resources. 120 */ 121 ROLLING_BACK { 122 public int value() { return 9; } 123 }; 124 125 /** 126 * The javax.transaction.Status constant code. 127 * @return Return the javax.transaction.Status code. 128 */ 129 public abstract int value(); 130 131}