1 21 22 package org.apache.derby.impl.store.access; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 import org.apache.derby.iapi.error.StandardException; 26 import org.apache.derby.iapi.store.access.TransactionController; 27 import org.apache.derby.iapi.services.context.ContextManager; 28 29 import org.apache.derby.iapi.services.context.ContextImpl; 30 import org.apache.derby.iapi.error.ExceptionSeverity; 31 final class RAMTransactionContext extends ContextImpl 32 { 33 36 protected RAMTransaction transaction; 37 38 41 private boolean abortAll; 42 43 46 47 54 public void cleanupOnError(Throwable error) 55 throws StandardException 56 { 57 if (SanityManager.DEBUG) 58 SanityManager.ASSERT(getContextManager() != null); 59 60 boolean destroy = false; 61 62 if (abortAll == false && (error instanceof StandardException)) 63 { 64 StandardException se = (StandardException) error; 65 66 if (se.getSeverity() < ExceptionSeverity.TRANSACTION_SEVERITY) 68 return; 69 70 if (se.getSeverity() >= ExceptionSeverity.SESSION_SEVERITY) 73 destroy = true; 74 } 75 else 76 { 77 destroy = true; 80 } 81 82 if (transaction != null) 83 { 84 try 85 { 86 transaction.invalidateConglomerateCache(); 87 } 88 catch (StandardException se) 89 { 90 if (SanityManager.DEBUG) 92 SanityManager.THROWASSERT( 93 "got error while invalidating cache."); 94 } 95 96 transaction.closeControllers(true ); 97 } 98 99 if (destroy) 100 { 101 transaction = null; 102 popMe(); 103 } 104 105 } 106 107 110 111 RAMTransactionContext( 115 ContextManager cm, 116 String context_id, 117 RAMTransaction theTransaction, 118 boolean abortAll) 119 throws StandardException 120 { 121 super(cm, context_id); 122 123 this.abortAll = abortAll; 124 transaction = theTransaction; 125 transaction.setContext(this); 126 } 127 128 RAMTransaction getTransaction() 129 { 130 return transaction; 131 } 132 133 void setTransaction( 134 RAMTransaction transaction) 135 { 136 this.transaction = transaction; 137 } 138 } 139 140 141 | Popular Tags |