/** * Sets UTF-8 as default encoding */ protected void setupEncoding() { Sirius.LOG.FINE("Setting " + Charsets.UTF_8.name() + " as default encoding (file.encoding)"); System.setProperty("file.encoding", Charsets.UTF_8.name()); Sirius.LOG.FINE("Setting " + Charsets.UTF_8.name() + " as default mime encoding (mail.mime.charset)"); System.setProperty("mail.mime.charset", Charsets.UTF_8.name()); }
/** * Sets the DNS cache to a sane value. * <p> * By default java infinitely caches all DNS entries. Will be changed to 10 seconds... */ protected void setupDNSCache() { Sirius.LOG.FINE("Setting DNS-Cache to 10 seconds..."); java.security.Security.setProperty("networkaddress.cache.ttl", "10"); }
private void loadMatchedResource(Matcher value, Map<String, Translation> newTranslations) { LOG.FINE("Loading: %s", value.group()); String baseName = value.group(1); String lang = value.group(2); importProperties(baseName, lang, newTranslations); loadedResourceBundles.add(value.group()); }
@Override public void trace(String message) { if (Tasks.LOG.isFINE()) { Tasks.LOG.FINE(ctx.getSystemString() + ": " + message); } }
@Override public ResultSet executeQuery(String sql) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return stmt.executeQuery(sql); } finally { updateStatistics(sql, w); } }
@Override public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return stmt.executeUpdate(sql, columnIndexes); } finally { updateStatistics(sql, w); } }
@Override public boolean execute() throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(preparedSQL); } Watch w = Watch.start(); try (Operation op = new Operation(() -> preparedSQL, Duration.ofSeconds(30))) { return delegate.execute(); } finally { updateStatistics(preparedSQL, w); } }
@Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return delegate.execute(sql, autoGeneratedKeys); } finally { updateStatistics(sql, w); } }
@Override public boolean execute(String sql) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return stmt.execute(sql); } finally { updateStatistics(sql, w); } }
@Override public boolean execute(String sql, String[] columnNames) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return stmt.execute(sql, columnNames); } finally { updateStatistics(sql, w); } }
@Override public int executeUpdate(String sql) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return delegate.executeUpdate(sql); } finally { updateStatistics(sql, w); } }
@Override public int executeUpdate() throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(preparedSQL); } Watch w = Watch.start(); try (Operation op = new Operation(() -> preparedSQL, Duration.ofSeconds(30))) { return delegate.executeUpdate(); } finally { updateStatistics(preparedSQL, w); } }
@Override public boolean execute(String sql, String[] columnNames) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return delegate.execute(sql, columnNames); } finally { updateStatistics(sql, w); } }
@Override public int executeUpdate(String sql) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return stmt.executeUpdate(sql); } finally { updateStatistics(sql, w); } }
@Override public ResultSet executeQuery(String sql) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return delegate.executeQuery(sql); } finally { updateStatistics(sql, w); } }
@Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return delegate.executeUpdate(sql, autoGeneratedKeys); } finally { updateStatistics(sql, w); } }
@Override public int executeUpdate(String sql, String[] columnNames) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return delegate.executeUpdate(sql, columnNames); } finally { updateStatistics(sql, w); } }
@Override public boolean execute(String sql, int[] columnIndexes) throws SQLException { if (Databases.LOG.isFINE()) { Databases.LOG.FINE(sql); } Watch w = Watch.start(); try (Operation op = new Operation(() -> sql, Duration.ofSeconds(30))) { return delegate.execute(sql, columnIndexes); } finally { updateStatistics(sql, w); } }
private void runEviction() { for (ManagedCache<?, ?> cache : CacheManager.getCaches()) { CacheManager.LOG.FINE("Running cache eviction for: %s", cache.getName()); cache.updateStatistics(); cache.runEviction(); } } }
private void buildAndLogExecutionInfo(Watch watch, LocalDateTime startedAt, String executedWorkDescription) { if (executedWorkDescription != null) { executionInfo = NLS.toUserString(startedAt) + " (" + watch.duration() + "): " + executedWorkDescription; Log.BACKGROUND.FINE(getName() + ": " + executionInfo); } else { executionInfo = NLS.toUserString(startedAt) + " (" + watch.duration() + ") - no work executed..."; } }