Hystrix: Latency and Fault Tolerance for Distributed Systems



com.netflix.hystrix.strategy.eventnotifier
Class HystrixEventNotifier

java.lang.Object
  extended by com.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifier

public abstract class HystrixEventNotifier
extends java.lang.Object

Abstract EventNotifier that allows receiving notifications for different events with default implementations.

See HystrixPlugins or the Hystrix GitHub Wiki for information on configuring plugins: https://github.com/Netflix/Hystrix/wiki/Plugins.

Note on thread-safety and performance

A single implementation of this class will be used globally so methods on this class will be invoked concurrently from multiple threads so all functionality must be thread-safe.

Methods are also invoked synchronously and will add to execution time of the commands so all behavior should be fast. If anything time-consuming is to be done it should be spawned asynchronously onto separate worker threads.


Constructor Summary
HystrixEventNotifier()
           
 
Method Summary
 void markCommandExecution(HystrixCommandKey key, HystrixCommandProperties.ExecutionIsolationStrategy isolationStrategy, int duration, java.util.List<HystrixEventType> eventsDuringExecution)
          Called after a command is executed using thread isolation.
 void markEvent(HystrixEventType eventType, HystrixCommandKey key)
          Called for every event fired.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HystrixEventNotifier

public HystrixEventNotifier()
Method Detail

markEvent

public void markEvent(HystrixEventType eventType,
                      HystrixCommandKey key)
Called for every event fired.

Default Implementation: Does nothing

Parameters:
eventType -
key -

markCommandExecution

public void markCommandExecution(HystrixCommandKey key,
                                 HystrixCommandProperties.ExecutionIsolationStrategy isolationStrategy,
                                 int duration,
                                 java.util.List<HystrixEventType> eventsDuringExecution)
Called after a command is executed using thread isolation.

Will not get called if a command is rejected, short-circuited etc.

Default Implementation: Does nothing

Parameters:
key - HystrixCommandKey of command instance.
isolationStrategy - HystrixCommandProperties.ExecutionIsolationStrategy the isolation strategy used by the command when executed
duration - time in milliseconds of executing run() method
eventsDuringExecution - List<HystrixEventType> of events occurred during execution.