@Override
    public void cleanableAdded(StatementContext statementContext, Cleanable cleanable) {
        checkNotNull(statementContext, "statementContext is null!");
        checkNotNull(cleanable, "cleanable is null");

        assertThat(contextElements)
            .withFailMessage(() -> format("statement context %s is unknown", statementContext))
            .containsKey(statementContext);

        RecordingContext<Cleanable> context = contextElements.get(statementContext);

        assertThat(context.objectAdded)
            .withFailMessage(() -> format("cleanable %s has already been added by thread %s", cleanable, context.objectAdded.get(cleanable)))
            .doesNotContainKey(cleanable);
        assertThat(context.objectRemoved)
            .withFailMessage(() -> format("cleanable %s has already been removed by thread %s", cleanable, context.objectRemoved.get(cleanable)))
            .doesNotContainKey(cleanable);

        context.objectAdded.putIfAbsent(cleanable, getThreadName());
    }
A simple leak checker that tracks statement context and cleanable resource management.
core/src/test/java/org/jdbi/v3/core/junit5/JdbiLeakChecker.java