Package ru.yoomoney.tech.dbqueue.config
Interface ThreadLifecycleListener
-
- All Known Implementing Classes:
CompositeThreadLifecycleListener,LoggingThreadLifecycleListener,NoopThreadLifecycleListener
public interface ThreadLifecycleListenerListener for task processing thread in the queue.- Since:
- 16.07.2017
-
-
Method Summary
All Methods Instance Methods Abstract 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
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.
-
finished
void finished(@Nonnull QueueShardId shardId, @Nonnull QueueLocation location)End of the task processing lifecycle and start of the new one.Always called, even after
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.
- Parameters:
shardId- Shard identifier, which processes the queue.location- Queue location.
-
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.
-
-