/** * Returns all detected component roots * * @return a list of URLs pointing to the component roots */ public List<URL> getComponentRoots() { if (componentRoots == null) { try { componentRoots = Collections.list(loader.getResources(componentName)); componentRoots.sort(Comparator.comparing(URL::toString)); } catch (IOException e) { LOG.SEVERE(e); } } return componentRoots; }
private Stream<String> scan(URL url) { List<String> result = new ArrayList<>(); if ("file".equals(url.getProtocol())) { try { File file = new File(url.toURI().getPath()); if (!file.isDirectory()) { file = file.getParentFile(); } addFiles(file, result, file); } catch (URISyntaxException e) { LOG.SEVERE(e); } } else if ("jar".equals(url.getProtocol())) { try { JarFile jar = ((JarURLConnection) url.openConnection()).getJarFile(); Enumeration<JarEntry> e = jar.entries(); while (e.hasMoreElements()) { JarEntry entry = e.nextElement(); result.add(entry.getName()); } } catch (IOException e) { LOG.SEVERE(e); } } return result.stream(); }
private void awaitClusterHealth() { try { containers().allContainers().forEach(this::awaitContainerStart); } catch (Exception e) { LOG.SEVERE(e); } }
LOG.SEVERE(msg.toString());
private void blockUnitExecutorTerminates(String name, AsyncExecutor exec) { LOG.INFO("Waiting for async executor '%s' to terminate...", name); try { if (!exec.awaitTermination(EXECUTOR_SHUTDOWN_WAIT.getSeconds(), TimeUnit.SECONDS)) { LOG.SEVERE(Strings.apply("Executor '%s' did not terminate within 60s. Interrupting " + "tasks...", name)); exec.shutdownNow(); if (!exec.awaitTermination(EXECUTOR_TERMINATION_WAIT.getSeconds(), TimeUnit.SECONDS)) { LOG.SEVERE(Strings.apply("Executor '%s' did not terminate after another 30s!", name)); } } } catch (InterruptedException ex) { Exceptions.ignore(ex); Thread.currentThread().interrupt(); LOG.SEVERE(Strings.apply("Interrupted while waiting for '%s' to terminate!", name)); } }
private void notifyHandlers(HandledException result) { // Injector might not have run yet if (handlers == null || Boolean.TRUE.equals(frozen.get())) { return; } try { frozen.set(Boolean.TRUE); String location = computeLocation(result); for (ExceptionHandler handler : handlers) { try { handler.handle(new Incident(log.getName(), location, CallContext.getCurrent().getMDC(), result)); } catch (Exception e) { // Just log the exception - anything else might call a rather long infinite loop LOG.SEVERE(new Exception(Strings.apply( "An error occurred while calling the ExceptionHandler: %s - %s (%s)", handler, e.getMessage(), e.getClass().getName()), e)); } } } finally { frozen.set(Boolean.FALSE); } }
/** * Loads all properties from the fields being present in the target type. */ protected void initialize() { addFields(this, AccessPath.IDENTITY, type, p -> { if (properties.containsKey(p.getName())) { Mixing.LOG.SEVERE(Strings.apply( "A property named '%s' already exists for the type '%s'. Skipping redefinition: %s", p.getName(), type.getSimpleName(), p.getDefinition())); } else { properties.put(p.getName(), p); } }); }
private void processFailures(BulkResponse res) { if (res.hasFailures()) { for (BulkItemResponse itemRes : res.getItems()) { if (itemRes.isFailed()) { IndexAccess.LOG.SEVERE("Re-Indexing failed: " + itemRes.getFailureMessage()); } } } } }
private Property createProperty(Class<?> rootClass, List<Property> props, Field field) { for (PropertyFactory f : Schema.factories.getParts()) { if (f.accepts(field)) { Property p = f.create(field); if (propertyAlreadyExists(props, p)) { IndexAccess.LOG.SEVERE(Strings.apply( "A property named '%s' already exists for the type '%s'. Cannot transform field %s", p.getName(), rootClass.getSimpleName(), field)); return null; } props.add(p); if (!p.acceptsSetter() && hasSetter(field)) { IndexAccess.LOG.WARN("Property %s in type %s does not accept a setter method to be present", field.getName(), rootClass.getSimpleName()); } return p; } } return null; }
private void awaitContainerStart(Container container) { LOG.INFO("Waiting for '%s' to become ready...", container.getContainerName()); try { int retries = MAX_WAIT_SECONDS; while (container.areAllPortsOpen().failed()) { Wait.seconds(1); if (retries-- <= 0) { LOG.WARN("Failed to start '%s' - Ports: %s", container.getContainerName(), container.ports().stream().map(Object::toString).collect(Collectors.joining(", "))); return; } } LOG.INFO("Container '%s' is ONLINE - Ports: %s", container.getContainerName(), container.ports().stream().map(Object::toString).collect(Collectors.joining(", "))); } catch (Exception e) { LOG.SEVERE(e); } }
HandledException result = new HandledException(message, ex); if (processError) { log.SEVERE(result); notifyHandlers(result); } else {
Redis.LOG.SEVERE(Strings.apply( "Missing a Redis host for config '%s'! This might lead to undefined behaviour." + " Please specify redis.host or redis.sentinels!",