Interface ThreadLifecycleListener

    • Method Detail

      • started

        void started​(@Nonnull
                     QueueShardId shardId,
                     @Nonnull
                     QueueLocation location)
        Start of the task processing in the queue.

        Always called.

        Might be useful for setting values in the logging context or change thread name.

        Parameters:
        shardId - Shard identifier, which processes the queue.
        location - Queue location.
      • executed

        void executed​(QueueShardId shardId,
                      QueueLocation location,
                      boolean taskProcessed,
                      long threadBusyTime)
        Thread was executed and finished processing.

        Called when normal end of task processing.

        Might be useful for measuring performance of the queue.

        Parameters:
        shardId - Shard identifier, which processes the queue.
        location - Queue location.
        taskProcessed - Attribute that task was taken and processed, no tasks for processing otherwise.
        threadBusyTime - Time in millis of the thread was running active before sleep.
      • crashed

        void crashed​(@Nonnull
                     QueueShardId shardId,
                     @Nonnull
                     QueueLocation location,
                     @Nullable
                     java.lang.Throwable exc)
        Queue failed with fatal error.

        Client code cannot trigger that method call, this method is called when task picking crashed.

        Might be useful for logging and monitoring.

        Parameters:
        shardId - Shard identifier, which processes the queue.
        location - Queue location.
        exc - An error caused the crash.