public class MetricsEventBus extends Object
| Constructor and Description |
|---|
MetricsEventBus() |
| Modifier and Type | Method and Description |
|---|---|
static void |
after(MetricsEvent event,
Object result) |
static void |
before(MetricsEvent event)
Applicable to the scene where execution and return are separated,
eventSaveRunner saves the event, so that the calculation rt is introverted
|
static void |
error(MetricsEvent event) |
static <T> T |
post(MetricsEvent event,
Supplier<T> targetSupplier)
Posts an event to all registered subscribers.
|
static <T> T |
post(MetricsEvent event,
Supplier<T> targetSupplier,
Function<T,Boolean> trFunction)
Full lifecycle post, success and failure conditions can be customized
|
static void |
publish(MetricsEvent event)
Posts an event to all registered subscribers and only once.
|
static void |
tryInvoke(Runnable runnable) |
public static void publish(MetricsEvent event)
event - event to post.public static <T> T post(MetricsEvent event, Supplier<T> targetSupplier)
event - event to post.targetSupplier - original processing result targetSupplierpublic static <T> T post(MetricsEvent event, Supplier<T> targetSupplier, Function<T,Boolean> trFunction)
T - Biz result typeevent - event to post.targetSupplier - original processing result suppliertrFunction - Custom event success criteria, judged according to the returned boolean typepublic static void tryInvoke(Runnable runnable)
public static void before(MetricsEvent event)
public static void after(MetricsEvent event, Object result)
public static void error(MetricsEvent event)
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.