Skip to content

Commit

Permalink
Add ClassCastException to lmax-4 failure
Browse files Browse the repository at this point in the history
During startup with an agent, the resulting object can be in the wrong classloader leading to a ClassCastException. Catching that falls back to the old behaviour which works fine

The new behaviour was introduced in 2.23.0 with apache#2112
  • Loading branch information
jackshirazi authored Jul 25, 2024
1 parent 29445d1 commit 1edc1c7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static EventHandler<RingBufferLogEvent> createEventHandler() {
if (DisruptorUtil.DISRUPTOR_MAJOR_VERSION == 3) {
try {
return LoaderUtil.newInstanceOf("org.apache.logging.log4j.core.async.RingBufferLogEventHandler");
} catch (final ReflectiveOperationException | LinkageError e) {
} catch (final ClassCastException | ReflectiveOperationException | LinkageError e) {
LOGGER.warn("Failed to create event handler for LMAX Disruptor 3.x, trying version 4.x.", e);
}
}
Expand Down

0 comments on commit 1edc1c7

Please sign in to comment.