Split out _runWorkItems
This commit is contained in:
parent
d91bb6dc02
commit
882b47602d
|
@ -198,11 +198,7 @@ public class Actor {
|
|||
}
|
||||
}
|
||||
|
||||
public void execute(WorkItem item) {
|
||||
tail.getAndSet(item).set(item);
|
||||
if (workItemCount.getAndIncrement() == 0) {
|
||||
_executor.execute(() -> {
|
||||
synchronized (this) {
|
||||
synchronized void _runWorkItems() {
|
||||
long batch = workItemCount.get();
|
||||
while (batch > 0) {
|
||||
for (int count = 0; count < batch; count++) {
|
||||
|
@ -215,7 +211,11 @@ public class Actor {
|
|||
batch = workItemCount.addAndGet(-batch);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public void execute(WorkItem item) {
|
||||
tail.getAndSet(item).set(item);
|
||||
if (workItemCount.getAndIncrement() == 0) {
|
||||
_executor.execute(this::_runWorkItems);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue