public static void traverse(final Path root, FileVisitor<Path> visitor) { try { Files.walkFileTree(root, visitor); } catch (IOException e) { Log.error("Error occurred while traversing the directory tree: " + root); } }
public void release(Connection connection) { try { connection.close(); } catch (SQLException e) { Log.error("Error while releasing a JDBC connection!", e); } }
public RapidoidServerLoop(NetworkingParams net, SSLContext sslContext) { super("server"); this.net = net; this.sslContext = sslContext; try { this.selector = Selector.open(); } catch (IOException e) { Log.error("Cannot open selector!", e); throw new RuntimeException(e); } }
@Override protected void failedOP(SelectionKey key, Throwable e) { Log.error("Network error", e); close(key); }
public static <T> void done(Callback<T> callback, T result, Throwable error) { if (callback != null) { try { callback.onDone(result, error); } catch (Exception e) { Log.error("Callback error", e); } } }
private static Map<String, String> loadIrregularPlural() { Properties props = new Properties(); try { props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("irregular-plural.txt")); } catch (IOException e) { Log.error("Couldn't load irregular plural!", e); } return U.cast(props); }
public static void error(String msg, String key1, double value1, String key2, boolean value2) { if (Log.isErrorEnabled()) { Log.error(msg, key1, value1, key2, value2); } }
private void acceptChannel(ServerSocketChannel serverChannel) { try { SocketChannel channel = serverChannel.accept(); currentWorker.accept(channel); currentWorker = currentWorker.next; } catch (IOException e) { Log.error("Acceptor error!", e); } }
public static void error(String msg, String key1, Object value1, String key2, long value2) { if (Log.isErrorEnabled()) { Log.error(msg, key1, value1, key2, value2); } }
public static void error(String msg, String key1, long value1, String key2, long value2) { if (Log.isErrorEnabled()) { Log.error(msg, key1, value1, key2, value2); } }
public synchronized void close() { try { client.resetAndClose(); } catch (Exception e) { Log.error("Error while closing the HTTP client!", e); } }
public static void error(String msg, String key, boolean value) { if (Log.isErrorEnabled()) { Log.error(msg, key, value); } }
public static void error(String msg, String key1, Object value1, String key2, boolean value2) { if (Log.isErrorEnabled()) { Log.error(msg, key1, value1, key2, value2); } }
public static void error(String msg, String key1, double value1, String key2, double value2) { if (Log.isErrorEnabled()) { Log.error(msg, key1, value1, key2, value2); } }
private boolean validate(T value) { boolean valid; try { valid = Lmbd.eval(isValid, value); } catch (Exception e) { Log.error("Validator failed!", e); errors().add("Invalid value!"); return false; } if (!valid) errors().add(message); return valid; }
public void forEach(Operation<Class<?>> classOperation) { for (Class<?> cls : loadAll()) { try { classOperation.execute(cls); } catch (Exception e) { Log.error("Cannot process annotated class!", e); } } }
private static void reloadAndRunMainClass() { Class<?> entry; try { entry = loader.loadClass(mainClassName); } catch (ClassNotFoundException e) { Log.error("Cannot restart the application, the main class (app entry point) is missing!"); return; } Msc.invokeMain(entry, U.arrayOf(String.class, Env.args())); }
@Override public final void reloadManageable() { final Promise<Void> promise = Promises.create(); doReloadManageable(promise); try { promise.get(5000); } catch (TimeoutException e) { Log.error("Couldn't reload the manageable!", e); } }
private static void notifyListenersAfterRestart() { Set<AppRestartListener> listeners = U.set(On.changes().getRestartListeners()); for (AppRestartListener listener : listeners) { try { listener.afterAppRestart(); } catch (Exception e) { Log.error("Error occurred in the app restart listener!", e); } } }
private void notifyChangeListener(ConfigChangeListener listener, Config previousConfig) { mustBeRoot(); Config cfg = U.notEmpty(listener.keys) ? sub(listener.keys) : this; ConfigChanges changes = cfg.getChangesSince(previousConfig); if (changes.count() > 0) { try { listener.operation.execute(changes); } catch (Exception e) { Log.error("Error occurred in a configuration changes listener!", e); } } }