public Session(Database database, User user, int id) { this.database = database; this.queryTimeout = database.getSettings().maxQueryTimeout; this.queryCacheSize = database.getSettings().queryCacheSize; this.user = user; this.id = id; Setting setting = database.findSetting(SetTypes.getTypeName(SetTypes.DEFAULT_LOCK_TIMEOUT)); this.lockTimeout = setting == null ? Constants.INITIAL_LOCK_TIMEOUT : setting.getIntValue(); this.currentSchemaName = Constants.SCHEMA_MAIN; }
public void setQueryTimeout(int queryTimeout) { int max = database.getSettings().maxQueryTimeout; if (max != 0 && (max < queryTimeout || queryTimeout == 0)) { // the value must be at most max queryTimeout = max; } this.queryTimeout = queryTimeout; // must reset the cancel at here, // otherwise it is still used this.cancelAt = 0; }
private void removeTemporaryLobs(boolean onTimeout) { if (temporaryLobs != null) { for (Value v : temporaryLobs) { if (!v.isLinkedToTable()) { v.remove(); } } temporaryLobs.clear(); } if (temporaryResultLobs != null && temporaryResultLobs.size() > 0) { long keepYoungerThan = System.currentTimeMillis() - database.getSettings().lobTimeout; while (temporaryResultLobs.size() > 0) { TimeoutValue tv = temporaryResultLobs.getFirst(); if (onTimeout && tv.created >= keepYoungerThan) { break; } Value v = temporaryResultLobs.removeFirst().value; if (!v.isLinkedToTable()) { v.remove(); } } } }