Exemplo n.º 1
0
 /**
  * @param success
  * @throws TeiidComponentException
  * @throws XATransactionException
  */
 public void pop(boolean success) throws TeiidComponentException {
   this.evaluator.close();
   Program program = this.programs.pop();
   VariableContext vc = this.currentVarContext;
   VariableContext cs = this.cursorStates;
   try {
     this.currentVarContext = this.currentVarContext.getParentContext();
     this.cursorStates = this.cursorStates.getParentContext();
     TempTableStore tempTableStore = program.getTempTableStore();
     this.getContext().setTempTableStore(tempTableStore.getParentTempTableStore());
     tempTableStore.removeTempTables();
     if (program.startedTxn()) {
       TransactionService ts = this.getContext().getTransactionServer();
       TransactionContext tc = this.blockContext;
       this.blockContext = null;
       try {
         ts.resume(tc);
         for (WeakReference<DataTierTupleSource> ref : txnTupleSources) {
           DataTierTupleSource dtts = ref.get();
           if (dtts != null) {
             dtts.fullyCloseSource();
           }
         }
         this.txnTupleSources.clear();
         if (success) {
           ts.commit(tc);
         } else {
           ts.rollback(tc);
         }
       } catch (XATransactionException e) {
         throw new TeiidComponentException(QueryPlugin.Event.TEIID30165, e);
       }
     }
   } finally {
     removeAllCursors(cs);
   }
 }