public final class GCNotificationEventEmitter extends Object implements NotificationListener
NotificationListener
tuned to listen for GC events and emit GC events on the Buck
event bus. This class receives GC events directly from the JVM and reports them in as high
fidelity as possible to various log systems, where they can be used to correlate JVM GCs with
other events in the Buck system.
This class is expected to work the same with any GC, but Buck currently uses the G1 GC, so its heuristics are tuned to that.
Modifier and Type | Method and Description |
---|---|
void |
handleNotification(Notification notification,
Object handback)
Handles a JMX
Notification emitted by one of the GC beans that we're listening to. |
static void |
register(BuckEventBus bus)
Registers for GC notifications to be sent to the given event bus.
|
public static void register(BuckEventBus bus)
bus
- The event bus to send GC events to.public void handleNotification(Notification notification, Object handback)
Notification
emitted by one of the GC beans that we're listening to. This
function is called on a special runtime thread that is not visible to debuggers, so if you're
trying to break in this method and it's not working, that's why.
Since this is called on a special thread, it's important that it 1) not block and 2) terminate as quickly as possible.
handleNotification
in interface NotificationListener
notification
- The notification that we've just received from JMXhandback
- An instance of the GarbageCollectorMXBean
that triggered the event,
which we passed explicitly as the third parameter of NotificationBroadcaster.addNotificationListener(NotificationListener, NotificationFilter,
Object)
in the class constructor.