Search in sources :

Example 1 with DataTierTupleSource

use of org.teiid.dqp.internal.process.DataTierTupleSource in project teiid by teiid.

the class ProcedurePlan method pop.

/**
 * @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);
    }
}
Also used : TempTableStore(org.teiid.query.tempdata.TempTableStore) TransactionService(org.teiid.dqp.service.TransactionService) TransactionContext(org.teiid.dqp.service.TransactionContext) DataTierTupleSource(org.teiid.dqp.internal.process.DataTierTupleSource) TeiidComponentException(org.teiid.core.TeiidComponentException) XATransactionException(org.teiid.client.xa.XATransactionException) VariableContext(org.teiid.query.sql.util.VariableContext)

Aggregations

XATransactionException (org.teiid.client.xa.XATransactionException)1 TeiidComponentException (org.teiid.core.TeiidComponentException)1 DataTierTupleSource (org.teiid.dqp.internal.process.DataTierTupleSource)1 TransactionContext (org.teiid.dqp.service.TransactionContext)1 TransactionService (org.teiid.dqp.service.TransactionService)1 VariableContext (org.teiid.query.sql.util.VariableContext)1 TempTableStore (org.teiid.query.tempdata.TempTableStore)1