@Override public void dispose() throws Throwable { if(null != scheduledExecutor) { log.debug("Shutdown scheduler '{}'", name); scheduledExecutor.shutdownNow(); } } }
@Override public <T> T readFirst(SqlExecutionContext context, ResultSet rs, Class<T> resultClass,SqlCommand command) throws SQLException { if(rs.next()){ ResultColumn[] columns = createResultColumns(context,command, rs); return readCurrentRow(context, rs, columns, resultClass); } log.debug("No result(s) returned"); return null; }
public void setNetworkTimeout(final Connection connection, final long timeoutMs) { if (supportsNetworkTimeout) { try { connection.setNetworkTimeout(getNetworkTimeoutExecutor(), (int) timeoutMs); } catch (Throwable e) { log.debug("Unable to reset network timeout for connection {}", connection.toString(), e); } } }
private void renderAndWriteFile(Mustache template, Map data, String filepath) { File file = folder.resolve(filepath).toFile(); if(filepath.indexOf('/') > 0) { Try.throwUnchecked(() -> Files.createDirectories(file.getParentFile().toPath())); } log.debug("Render template '{}' and write to '{}'", template.getName(), filepath); IO.writeString(file, template.render(data)); }
public BeanContainer loadFromClasses(Class<?>[] classes) throws IllegalStateException{ log.debug("Load beans from {} classes",classes.length); ensureContainerNotInited(); this.annotationBeanDefinitionLoader.load(this,classes); return this; }
public synchronized void addCookie(final org.apache.http.cookie.Cookie cookie) { if (cookie != null) { log.debug("Add cookie : name={}, path={}, value={},", cookie.getName(), cookie.getPath(), cookie.getValue()); // first remove any old cookie that is equivalent cookies.remove(cookie); if (!cookie.isExpired(new Date())) { cookies.add(cookie); } } }
@Override public void postProcessEnvironment(ConfigurableEnvironment env, SpringApplication app) { addMetaPropertySources(env); log.debug("Add leap property source"); env.getPropertySources().addLast(new SpringPropertySource("leap")); }
protected void readOptions(MetaApi api) { for (Resource resource : cfg.scanOptions()) { if (resource.exists()) { log.debug("Read option set resource : {}", resource.getDescription()); exec(resource, () -> optionsReader.read(api, resource)); } } log.debug("Read {} option sets", api.getOptionSets().size()); }
protected Connection getConnection() throws NestedSQLException { LocalTransaction transaction = peekActiveTransaction(); if(transaction == null){ log.debug("Fetching JDBC Connection from {} Non Transactional", dataSourceInfo); return fetchConnectionFromDataSource(); } if(!transaction.hasConnection()){ log.debug("Fetching JDBC Connection from {} Transactional", dataSourceInfo); transaction.setConnection(fetchConnectionFromDataSource()); } return transaction.getConnection(); }
protected void closeConnection(Connection connection) { if(null == connection){ return; } LocalTransaction transaction = peekActiveTransaction(); if(null != transaction && connectionEquals(transaction, connection)){ return; } log.debug("Returning JDBC Connection to {}", dataSourceInfo); returnConnectionToDataSource(connection); }
@Override public <T> T executeQuery(QueryContext context, Object params,ResultSetReader<T> reader) throws NestedSQLException { //Assert.isTrue(null != queryClause,"This command is not a query, cannot execute query"); log.debug("Executing sql query: '{}'", desc()); mustPrepare(context); if(clauses.length == 1){ return clauses[0].createQueryStatement(context, params).executeQuery(reader); }else{ throw new IllegalStateException("Two or more sql statements in a sql command not supported now"); } }
private void loadResource(Resource resource) { Dbms mdb = JSON.decode(resource.getContent(), Dbms.class); beanValidator.validate(mdb); log.debug("Load database '{}', drive class name : {}", mdb.getName(), mdb.getDriverClassName()); map.put(mdb.getName().toLowerCase(), mdb); } }
protected void readDomains(MetaApi api) { for(Resource resource : cfg.getResources("domains.json")) { if (resource.exists()) { exec(resource, () -> domainReader.read(api, resource)); } } log.debug("Read {} domains", formats.app().size()); }
private Object eval(Map<String, Object> vars, boolean wrap) throws ScriptException { compile(wrap); log.debug("Eval '{}'", filename); Bindings bindings = configure(engine.initEvalBindings(vars)); return doEval(bindings); }
void closeReal() { if(null != conn) { JDBC.closeConnection(conn); conn = null; if(log.isDebugEnabled()) { String state = pool.getStateInfo(); log.debug("Underlying connection closed! {} : [{}]", pool.getName(), state); } } }
protected void doLoadSqls(LoadingContext context) { StopWatch sw = StopWatch.startNew(); //init sql commands for(SqlSource ss : sqlSources){ ss.loadSqlCommands(context); } log.debug("Load {} sqls used {}ms",context.getMetadata().getSqlCommandSize(),sw.getElapsedMilliseconds()); }
public void buildStatement(SqlContext context, Sql sql, SqlStatementBuilder stm, Params params, String text) throws IOException { if(log.isDebugEnabled()) { log.debug("Tag {} -> {}", toString(), text); } SqlParser parser = new SqlParser(new Lexer(text, Sql.ParseLevel.MORE), el); SqlWhereExpr expr = parser.whereExpr(); expr.buildStatement(context, sql, stm, params); } }
protected void checkForColumnNullableChange(List<ColumnPropertyChange> changes, DbTable sourceTable, DbColumn sourceColumn, DbTable targetTable, DbColumn targetColumn){ if(sourceColumn.isNullable() != targetColumn.isNullable()){ log.debug("Nullable changed in column '{}.{}', [{}] -> [{}]", sourceTable.getName(), sourceColumn.getName(), targetColumn.isNullable() ? "null" : "not null", sourceColumn.isNullable() ? "null" : "not null"); changes.add(new ColumnPropertyChange(targetColumn, ColumnPropertyChange.NULLABLE, targetColumn.isNullable(), sourceColumn.isNullable()).setTable(sourceTable)); } }
protected void checkForPropertyChanges(GenericSchemaChanges changes, DbTable source, DbTable target){ if(!Strings.equals(Strings.trimToNull(source.getComment()),Strings.trimToNull(target.getComment()))){ log.debug("Comment changed in table '{}'",source.getName()); changes.add(new TablePropertyChange(target, TablePropertyChange.COMMENT, target.getComment(), source.getComment())); } }