Merge branch 'stable-2.16' into stable-3.0
* stable-2.16: UniversalGroupBackend: Fix comparison of boxed Boolean as primitive UniversalGroupBackend: Replace repeated log statements with single log Fix ModifyCollectionInEnhancedForLoop warning flagged by error prone Update git submodules Change-Id: Id67d1294cc17a8e441aeff810c5b294fba95a00e
This commit is contained in:
@@ -21,8 +21,8 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.gerrit.metrics.Description;
|
import com.google.gerrit.metrics.Description;
|
||||||
import com.google.gerrit.metrics.Field;
|
import com.google.gerrit.metrics.Field;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/** Abstract callback metric broken down into buckets. */
|
/** Abstract callback metric broken down into buckets. */
|
||||||
@@ -67,10 +67,11 @@ abstract class BucketedCallback<V> implements BucketedMetric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void doPrune() {
|
void doPrune() {
|
||||||
Set<Map.Entry<Object, BucketedCallback<V>.ValueGauge>> entries = cells.entrySet();
|
Iterator<Map.Entry<Object, ValueGauge>> it = cells.entrySet().iterator();
|
||||||
for (Map.Entry<Object, ValueGauge> e : entries) {
|
while (it.hasNext()) {
|
||||||
|
Map.Entry<Object, ValueGauge> e = it.next();
|
||||||
if (!e.getValue().set) {
|
if (!e.getValue().set) {
|
||||||
entries.remove(e);
|
it.remove();
|
||||||
registry.remove(submetric(e.getKey()));
|
registry.remove(submetric(e.getKey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class UniversalGroupBackend implements GroupBackend {
|
|||||||
private GroupBackend backend(AccountGroup.UUID uuid) {
|
private GroupBackend backend(AccountGroup.UUID uuid) {
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
for (PluginSetEntryContext<GroupBackend> c : backends) {
|
for (PluginSetEntryContext<GroupBackend> c : backends) {
|
||||||
if (c.call(b -> b.handles(uuid))) {
|
if (Boolean.TRUE.equals(c.call(b -> b.handles(uuid)))) {
|
||||||
return c.get();
|
return c.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,6 +116,7 @@ public class UniversalGroupBackend implements GroupBackend {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logger.atFine().log("Unknown GroupMembership for UUID: %s", uuid);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +127,6 @@ public class UniversalGroupBackend implements GroupBackend {
|
|||||||
}
|
}
|
||||||
GroupMembership m = membership(uuid);
|
GroupMembership m = membership(uuid);
|
||||||
if (m == null) {
|
if (m == null) {
|
||||||
logger.atFine().log("Unknown GroupMembership for UUID: %s", uuid);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m.contains(uuid);
|
return m.contains(uuid);
|
||||||
@@ -142,7 +142,6 @@ public class UniversalGroupBackend implements GroupBackend {
|
|||||||
}
|
}
|
||||||
GroupMembership m = membership(uuid);
|
GroupMembership m = membership(uuid);
|
||||||
if (m == null) {
|
if (m == null) {
|
||||||
logger.atFine().log("Unknown GroupMembership for UUID: %s", uuid);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lookups.put(m, uuid);
|
lookups.put(m, uuid);
|
||||||
@@ -198,7 +197,7 @@ public class UniversalGroupBackend implements GroupBackend {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isVisibleToAll(AccountGroup.UUID uuid) {
|
public boolean isVisibleToAll(AccountGroup.UUID uuid) {
|
||||||
for (PluginSetEntryContext<GroupBackend> c : backends) {
|
for (PluginSetEntryContext<GroupBackend> c : backends) {
|
||||||
if (c.call(b -> b.handles(uuid))) {
|
if (Boolean.TRUE.equals(c.call(b -> b.handles(uuid)))) {
|
||||||
return c.call(b -> b.isVisibleToAll(uuid));
|
return c.call(b -> b.isVisibleToAll(uuid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user