Reuse a runnable

This commit is contained in:
Tony Garnock-Jones 2023-10-28 21:00:53 +02:00
parent 9c7b71fa51
commit 90147b4970
1 changed files with 3 additions and 1 deletions

View File

@ -212,10 +212,12 @@ public class Actor {
}
}
private Runnable __runWorkItems = this::_runWorkItems;
public void execute(WorkItem item) {
tail.getAndSet(item).set(item);
if (workItemCount.getAndIncrement() == 0) {
_executor.execute(this::_runWorkItems);
_executor.execute(__runWorkItems);
}
}