Only compute if absent/present if compute is not needed (locking opts)

This commit is contained in:
cyberpwn
2021-09-13 09:31:56 -04:00
parent ca961e8498
commit eeab12ed86
18 changed files with 25 additions and 64 deletions

View File

@@ -85,7 +85,6 @@ public class GroupedExecutor {
public void queue(String q, NastyRunnable r) {
mirror.compute(q, (k, v) -> k == null || v == null ? 1 : v + 1);
service.execute(() ->
{
try {
@@ -95,7 +94,7 @@ public class GroupedExecutor {
e.printStackTrace();
}
mirror.compute(q, (k, v) -> v - 1);
mirror.computeIfPresent(q, (k, v) -> v - 1);
});
}