coderzc commented on PR #18478:
URL: https://github.com/apache/pulsar/pull/18478#issuecomment-1316690964
I think a way to keep it lock-free, we can use `SingleThreadEventExecutor`
of netty instead of `ExecutorService` and overwrite the `execute` method:
```java
class ReentrantSingleThreadEventExecutor extends SingleThreadEventExecutor {
@Override
protected void run() {
do {
Runnable task = this.takeTask();
if (task != null) {
runTask(task);
this.updateLastExecutionTime();
}
} while(!this.confirmShutdown());
}
@Override
public void execute(Runnable task) {
if (inEventLoop()) {
task.run();
} else {
super.execute(task);
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]