Class AbstractBuckEvent

    • Constructor Detail

      • AbstractBuckEvent

        protected AbstractBuckEvent​(EventKey eventKey)
    • Method Detail

      • configure

        public void configure​(long timestampMillis,
                              long nanoTime,
                              long threadUserNanoTime,
                              long threadId,
                              BuildId buildId)
        Method to configure an event before posting it to the BuckEventBus. This method should only be invoked once per event, and only by the BuckEventBus in production code.
        Specified by:
        configure in interface BuckEvent
      • getBuildId

        public BuildId getBuildId()
        Specified by:
        getBuildId in interface BuckEvent
        Returns:
        an identifier that distinguishes the build with which this event is associated.
      • getEventKey

        public final EventKey getEventKey()
        Specified by:
        getEventKey in interface BuckEvent
        Returns:
        key used to determine whether this event is related to another event.
      • isRelatedTo

        public final boolean isRelatedTo​(BuckEvent event)
        Specified by:
        isRelatedTo in interface BuckEvent
        Returns:
        Whether or not this event is related to another event. Events are related if they pertain to the same event, for example if they are measuring the start and stop of some phase. For example,
           
            (CommandEvent.started("build")).isRelatedTo(CommandEvent.finished("build")) == true
            (CommandEvent.started("build")).isRelatedTo(CommandEvent.started("build")) == true
            (CommandEvent.started("build")).isRelatedTo(CommandEvent.finished("install")) == false
           
         
      • getValueString

        protected abstract String getValueString()
      • equals

        public boolean equals​(Object o)
        The default implementation of equals checks to see if two events are related, are on the same thread, and are the same concrete class. Subclasses therefore can simply override isRelatedTo, and the equals method will work correctly.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object