Class LoggingThreadLifecycleListener
- java.lang.Object
-
- ru.yoomoney.tech.dbqueue.config.impl.LoggingThreadLifecycleListener
-
- All Implemented Interfaces:
ThreadLifecycleListener
public class LoggingThreadLifecycleListener extends java.lang.Object implements ThreadLifecycleListener
Thread listener with logging support- Since:
- 11.06.2021
-
-
Constructor Summary
Constructors Constructor Description LoggingThreadLifecycleListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcrashed(QueueShardId shardId, QueueLocation location, java.lang.Throwable exc)Queue failed with fatal error.voidexecuted(QueueShardId shardId, QueueLocation location, boolean taskProcessed, long threadBusyTime)Thread was executed and finished processing.voidfinished(QueueShardId shardId, QueueLocation location)End of the task processing lifecycle and start of the new one.voidstarted(QueueShardId shardId, QueueLocation location)Start of the task processing in the queue.
-
-
-
Method Detail
-
started
public void started(@Nonnull QueueShardId shardId, @Nonnull QueueLocation location)Description copied from interface:ThreadLifecycleListenerStart of the task processing in the queue.Always called.
Might be useful for setting values in the logging context or change thread name.
- Specified by:
startedin interfaceThreadLifecycleListener- Parameters:
shardId- Shard identifier, which processes the queue.location- Queue location.
-
executed
public void executed(QueueShardId shardId, QueueLocation location, boolean taskProcessed, long threadBusyTime)
Description copied from interface:ThreadLifecycleListenerThread was executed and finished processing.Called when normal end of task processing.
Might be useful for measuring performance of the queue.
- Specified by:
executedin interfaceThreadLifecycleListener- 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.
-
finished
public void finished(@Nonnull QueueShardId shardId, @Nonnull QueueLocation location)Description copied from interface:ThreadLifecycleListenerEnd of the task processing lifecycle and start of the new one.Always called, even after
ThreadLifecycleListener.crashed(ru.yoomoney.tech.dbqueue.config.QueueShardId, ru.yoomoney.tech.dbqueue.settings.QueueLocation, java.lang.Throwable).Might be useful for logging context return or move the thread to the initial state.
- Specified by:
finishedin interfaceThreadLifecycleListener- Parameters:
shardId- Shard identifier, which processes the queue.location- Queue location.
-
crashed
public void crashed(@Nonnull QueueShardId shardId, @Nonnull QueueLocation location, @Nullable java.lang.Throwable exc)Description copied from interface:ThreadLifecycleListenerQueue 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.
- Specified by:
crashedin interfaceThreadLifecycleListener- Parameters:
shardId- Shard identifier, which processes the queue.location- Queue location.exc- An error caused the crash.
-
-