Use Collection.removeIf() where possible (#1747)
Use Collection.removeIf() where possible Issue: SPR-16622
This commit is contained in:
committed by
Juergen Hoeller
parent
e0de9126ed
commit
d3a0a8e007
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,6 @@ import java.net.UnknownHostException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
@@ -175,13 +174,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
|
||||
|
||||
void purgeExpiredRegistries() {
|
||||
long now = System.currentTimeMillis();
|
||||
Iterator<Map.Entry<String, UserRegistrySnapshot>> iterator = this.remoteRegistries.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, UserRegistrySnapshot> entry = iterator.next();
|
||||
if (entry.getValue().isExpired(now)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
this.remoteRegistries.entrySet().removeIf(entry -> entry.getValue().isExpired(now));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user