[
https://issues.apache.org/jira/browse/LOG4J2-1797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15884093#comment-15884093
]
Remko Popma commented on LOG4J2-1797:
-------------------------------------
Would it be possible to use the LMAX ExceptionHandler interface (or introduce
our own interface which has match the signature of {{handleEventException}} so
we can have one impl that satisfies both interfaces)? I also like the idea of
having a {{handleOnShutdownException}} method.
Here is what the LMAX interface looks like, javadocs and all:
{code}
/**
* Callback handler for uncaught exceptions in the event processing cycle of
the {@link BatchEventProcessor}
*/
public interface ExceptionHandler<T> {
/**
* <p>Strategy for handling uncaught exceptions when processing an
event.</p>
* <p>
* <p>If the strategy wishes to terminate further processing by the {@link
BatchEventProcessor}
* then it should throw a {@link RuntimeException}.</p>
*
* @param ex the exception that propagated from the {@link
EventHandler}.
* @param sequence of the event which cause the exception.
* @param event being processed when the exception occurred. This can
be null.
void handleEventException(Throwable ex, long sequence, T event);
/**
* Callback to notify of an exception during {@link
LifecycleAware#onStart()}
* @param ex throw during the starting process.
*/
void handleOnStartException(Throwable ex);
/**
* Callback to notify of an exception during {@link
LifecycleAware#onShutdown()}
* @param ex throw during the shutdown process.
*/
void handleOnShutdownException(Throwable ex);
}
{code}
> Add asynchronous/non-blocking SPIs for appenders
> ------------------------------------------------
>
> Key: LOG4J2-1797
> URL: https://issues.apache.org/jira/browse/LOG4J2-1797
> Project: Log4j 2
> Issue Type: Improvement
> Components: Appenders
> Reporter: Matt Sicker
>
> Some appenders (e.g., Kafka and Cassandra) support using an asynchronous SPI
> with callbacks (to make them non-blocking). In a Scala-based API, this could
> be easily handled with the Future class, and with Java 8, this could be
> easily handled with a CompleteableFuture class. However, if this API
> improvement is desired for Java 7, then we'd need to create a basic callback
> API that would ideally be easy to update to CompleteableFuture later on.
> In theory, such an SPI could also be adapted to use the Flow classes in Java
> 9. This may be an interesting API to follow as we could use the Reactive
> Streams standard API or a compatible API.
> Some main things that would be desirable in such an SPI would include
> asynchronous error handling (e.g., to trigger a failover appender). This
> should be adapted to work well with the generic AsyncAppender and AsyncLogger
> as well.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]