Class MessageTracker
java.lang.Object
org.opendaylight.controller.cluster.common.actor.MessageTracker
MessageTracker is a diagnostic utility class to be used for figuring out why a certain message which was
expected to arrive in a given time interval does not arrive. It attempts to keep track of all the messages that
received between the arrival of two instances of the same message and the amount of time it took to process each
of those messages.
Usage of the API is as follows,
Usage of the API is as follows,
// Track the Foo class, Here we expect to see a message of type Foo come in every 10 millis MessageTracker tracker = new MessageTracker(Foo.class, 10); // Begin the tracking process. If this is not called then calling received and done on the resultant Context // will do nothing tracker.begin(); ..... try (MessageTracker.Context context = tracker.received(message)) { if (context.error().isPresent()){ LOG.error("{}", context.error().get()); } // Some custom processing process(message); }
This class is NOT thread-safe.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
static final class
-
Constructor Summary
ConstructorsConstructorDescriptionMessageTracker
(Class<?> expectedMessageClass, long expectedArrivalIntervalInMillis) Constructs an instance. -
Method Summary
-
Constructor Details
-
MessageTracker
Constructs an instance.- Parameters:
expectedMessageClass
- the class of the message to trackexpectedArrivalIntervalInMillis
- the expected arrival interval between two instances of the expected message
-
-
Method Details
-
begin
public void begin() -
received
-
getMessagesSinceLastExpectedMessage
-