Reuse a runnable
This commit is contained in:
parent
9c7b71fa51
commit
90147b4970
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue