use of org.teiid.translator.ReusableExecution 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();
}
}
}
Aggregations