1 21 22 package org.apache.derby.iapi.store.raw.xact; 23 24 import org.apache.derby.iapi.store.raw.ContainerKey; 25 26 import org.apache.derby.iapi.services.locks.LockFactory; 27 28 import org.apache.derby.iapi.store.raw.data.DataFactory; 29 import org.apache.derby.iapi.store.raw.Compensation; 30 import org.apache.derby.iapi.store.raw.LockingPolicy; 31 import org.apache.derby.iapi.store.raw.Loggable; 32 import org.apache.derby.iapi.store.raw.Transaction; 33 import org.apache.derby.iapi.store.raw.GlobalTransactionId; 34 import org.apache.derby.iapi.store.raw.log.LogInstant; 35 import org.apache.derby.iapi.store.raw.data.RawContainerHandle; 36 import org.apache.derby.iapi.error.StandardException; 37 38 import org.apache.derby.iapi.util.ByteArray; 39 import org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream; 40 import org.apache.derby.catalog.UUID; 41 42 43 import java.util.Observable ; 44 45 import org.apache.derby.iapi.services.io.LimitObjectInput; 46 47 67 68 public abstract class RawTransaction extends Observable implements Transaction { 69 70 public static final Integer COMMIT = new Integer (0); 71 public static final Integer ABORT = new Integer (1); 72 public static final Integer SAVEPOINT_ROLLBACK = new Integer (2); 73 public static final Integer LOCK_ESCALATE = new Integer (3); 74 75 protected StandardException observerException; 76 77 80 public abstract LockFactory getLockFactory(); 81 82 85 public abstract DataFactory getDataFactory(); 86 87 90 public abstract long[] getCacheStats(String cacheName); 91 92 95 public abstract void resetCacheStats(String cacheName); 96 97 100 public abstract DynamicByteArrayOutputStream getLogBuffer(); 101 102 119 public abstract void logAndUndo(Compensation compensation, LogInstant undoInstant, 120 LimitObjectInput in) 121 throws StandardException; 122 123 124 125 128 public abstract void setTransactionId(GlobalTransactionId id, TransactionId shortId); 129 130 134 abstract public void setTransactionId(Loggable beginXact, TransactionId shortId); 135 136 137 141 abstract public TransactionId getId(); 142 143 147 abstract public GlobalTransactionId getGlobalId(); 148 149 152 public abstract void addUpdateTransaction(int transactionStatus); 153 154 157 public abstract void removeUpdateTransaction(); 158 159 162 public abstract void prepareTransaction(); 163 164 168 abstract public void setFirstLogInstant(LogInstant instant); 169 170 174 abstract public LogInstant getFirstLogInstant(); 175 176 179 abstract public void setLastLogInstant(LogInstant instant); 180 181 186 abstract public LogInstant getLastLogInstant(); 187 188 189 197 public void checkLogicalOperationOk() throws StandardException { 198 } 199 200 205 public boolean recoveryRollbackFirst() { 206 return false; 207 } 208 209 221 abstract public void reprepare() 222 throws StandardException; 223 224 228 public void setObserverException(StandardException se) { 229 if (observerException == null) 230 observerException = se; 231 } 232 233 248 249 public abstract RawTransaction startNestedTopTransaction() throws StandardException; 250 251 252 266 public abstract RawContainerHandle openDroppedContainer 267 (ContainerKey containerId, LockingPolicy locking) 268 throws StandardException; 269 270 278 public abstract void reCreateContainerForRedoRecovery 279 (long segmentId, long containerId, ByteArray containerInfo) 280 throws StandardException; 281 282 283 287 protected abstract int statusForBeginXactLog(); 288 289 293 protected abstract int statusForEndXactLog(); 294 295 298 public abstract boolean inAbort(); 299 300 303 public abstract boolean handlesPostTerminationWork(); 304 305 308 public abstract void recoveryTransaction(); 309 310 313 public void notifyObservers(Object arg) { 314 if (countObservers() != 0) { 315 setChanged(); 316 super.notifyObservers(arg); 317 } 318 } 319 320 321 324 public abstract boolean inRollForwardRecovery(); 325 326 327 330 public abstract void checkpointInRollForwardRecovery(LogInstant cinstant, 331 long redoLWM) 332 throws StandardException; 333 334 335 345 public abstract boolean blockBackup(boolean wait) 346 throws StandardException; 347 348 353 public abstract boolean isBlockingBackup(); 354 355 } 356 357 358 | Popular Tags |