Search in sources :

Example 1 with CommandListener

use of org.teiid.CommandListener in project teiid by teiid.

the class CommandContext method close.

public void close() {
    synchronized (this.globalState) {
        if (this.globalState.reservedBuffers > 0) {
            long toRelease = this.globalState.reservedBuffers;
            this.globalState.reservedBuffers = 0;
            this.globalState.bufferManager.releaseOrphanedBuffers(toRelease);
        }
        if (this.globalState.reusableExecutions != null) {
            for (List<ReusableExecution<?>> reusableExecutions : this.globalState.reusableExecutions.values()) {
                for (ReusableExecution<?> reusableExecution : reusableExecutions) {
                    try {
                        reusableExecution.dispose();
                    } catch (Exception e) {
                        LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30030));
                    }
                }
            }
            this.globalState.reusableExecutions.clear();
        }
        if (this.globalState.commandListeners != null) {
            for (CommandListener listener : this.globalState.commandListeners) {
                try {
                    listener.commandClosed(this);
                } catch (Exception e) {
                    LogManager.logWarning(LogConstants.CTX_DQP, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30031));
                }
            }
            this.globalState.commandListeners.clear();
        }
        if (this.globalState.lookups != null) {
            for (TupleSource ts : this.globalState.lookups.values()) {
                ts.closeSource();
            }
            this.globalState.lookups = null;
        }
        if (this.globalState.created != null) {
            for (InputStreamFactory isf : this.globalState.created) {
                try {
                    isf.free();
                } catch (IOException e) {
                }
            }
            this.globalState.created.clear();
        }
    }
}
Also used : CommandListener(org.teiid.CommandListener) TupleSource(org.teiid.common.buffer.TupleSource) ReusableExecution(org.teiid.translator.ReusableExecution) IOException(java.io.IOException) InputStreamFactory(org.teiid.core.types.InputStreamFactory) QueryProcessingException(org.teiid.api.exception.query.QueryProcessingException) TeiidComponentException(org.teiid.core.TeiidComponentException) TeiidException(org.teiid.core.TeiidException) TeiidSQLException(org.teiid.jdbc.TeiidSQLException) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 CommandListener (org.teiid.CommandListener)1 QueryProcessingException (org.teiid.api.exception.query.QueryProcessingException)1 TupleSource (org.teiid.common.buffer.TupleSource)1 TeiidComponentException (org.teiid.core.TeiidComponentException)1 TeiidException (org.teiid.core.TeiidException)1 InputStreamFactory (org.teiid.core.types.InputStreamFactory)1 TeiidSQLException (org.teiid.jdbc.TeiidSQLException)1 ReusableExecution (org.teiid.translator.ReusableExecution)1