Refine search
private void warnAboutDeprecatedConnectors( @Nonnull Map<String,String> connectorSettings, @Nonnull Consumer<String> warningConsumer ) { final HashSet<String> nonDefaultConnectors = new HashSet<>(); connectorSettings.entrySet().stream() .map( Entry::getKey ) .filter( settingKey -> { String name = settingKey.split( "\\." )[2]; return isDeprecatedConnectorName( name ); } ) .forEach( nonDefaultConnectors::add ); if ( !nonDefaultConnectors.isEmpty() ) { warningConsumer.accept( format( DEPRECATED_CONNECTOR_MSG, nonDefaultConnectors.stream() .sorted() .map( s -> format( "> %s%n", s ) ) .collect( joining() ) ) ); } }
/** * Posts provided event to all registered subscribers. Subscriber calls are invoked immediately and in order * in which subscribers were registered. * * @param event event to post */ public void post(@Nonnull final Object event) { for (final Subscriber subscriber : subscribers.get(event.getClass())) { try { subscriber.invoke(event); } catch (Exception e) { exceptionHandler.accept(e); } } }
/** * Creates a wrapping {@link java.util.function.Consumer Consumer} for * the provided target. * * @param acceptor * The end-target for the throwable * * @return Wrapper of the provided consumer that will append a context with the current stack-trace */ @Nonnull public static Consumer<Throwable> here(@Nonnull Consumer<? super Throwable> acceptor) { ContextException context = new ContextException(); return (ex) -> { Throwable cause = ex; while (cause.getCause() != null) cause = cause.getCause(); cause.initCause(context); if (acceptor != null) acceptor.accept(ex); }; } }