Interface EventKeeper

  • All Known Implementing Classes:
    MapEventKeeper

    public interface EventKeeper
    A device for externally instrumenting the FDB java driver, for monitoring purposes. Note that implementations as expected to be thread-safe, and may be manipulated from multiple threads even in nicely single-threaded-looking applications.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  EventKeeper.Event
      Marker interface for tracking the specific type of event that occurs, and metadata about said event.
      static class  EventKeeper.Events
      An enumeration of static events which occur within the FDB Java driver.
    • Method Detail

      • count

        void count​(EventKeeper.Event event,
                   long amt)
        Count the number of events which occurred.
        Parameters:
        event - the event which occurred
        amt - the number of times that even occurred
      • increment

        default void increment​(EventKeeper.Event event)
        Convenience method to add 1 to the number of events which occurred.
        Parameters:
        event - the event which occurred.
      • timeNanos

        void timeNanos​(EventKeeper.Event event,
                       long nanos)
        Count the time taken to perform an event, in nanoseconds. Note that event.isTimeEvent() should return true here.
        Parameters:
        event - the event which was timed (the event should be a time event).
        nanos - the amount of time taken (in nanoseconds)
      • time

        default void time​(EventKeeper.Event event,
                          long duration,
                          java.util.concurrent.TimeUnit theUnit)
        Count the time taken to perform an action, in the specified units. Note that event.isTimeEvent() should return true.
        Parameters:
        event - the event which was timed.
        duration - the time taken
        theUnit - the unit of time in which the time measurement was taken
      • getCount

        long getCount​(EventKeeper.Event event)
        Get the number of events which occurred since this timer was created. If the event was never recorded, then this returns 0.
        Parameters:
        event - the event to get the count for
        Returns:
        the number of times the event was triggered. If the event has never been triggered, then this returns 0
      • getTimeNanos

        long getTimeNanos​(EventKeeper.Event event)
        Get the amount of time taken by this event, in nanoseconds.
        Parameters:
        event - the event to get the time for
        Returns:
        the total time measured for this event, in nanoseconds. If the event was never recorded, return 0 instead.
      • getTime

        default long getTime​(EventKeeper.Event event,
                             java.util.concurrent.TimeUnit theUnit)
        Get the amount of time taken by this event, in the specified units. Important note: If the time that was measured in nanoseconds does not evenly divide the unit that is specified (which is likely, considering time), then some precision may be lost in the conversion. Use this carefully.
        Parameters:
        event - the event to get the time for
        theUnit - the unit to get time in
        Returns:
        the total time measured for this event, in the specified unit. If the event was never recorded, return 0.