Prevent concurrent modification exception.
This commit is contained in:
parent
4fc0d6fc63
commit
6a1273e701
1 changed files with 7 additions and 3 deletions
|
|
@ -140,7 +140,8 @@ public class VmPool {
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("PMD.AvoidLiteralsInIfCondition")
|
@SuppressWarnings({ "PMD.AvoidLiteralsInIfCondition",
|
||||||
|
"PMD.AvoidSynchronizedStatement" })
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder(50);
|
StringBuilder builder = new StringBuilder(50);
|
||||||
builder.append("VmPool [name=").append(name).append(", permissions=")
|
builder.append("VmPool [name=").append(name).append(", permissions=")
|
||||||
|
|
@ -148,8 +149,11 @@ public class VmPool {
|
||||||
if (vms.size() <= 3) {
|
if (vms.size() <= 3) {
|
||||||
builder.append(vms);
|
builder.append(vms);
|
||||||
} else {
|
} else {
|
||||||
builder.append('[').append(vms.stream().limit(3).map(s -> s + ",")
|
synchronized (vms) {
|
||||||
.collect(Collectors.joining())).append("...]");
|
builder.append('[').append(vms.stream().limit(3)
|
||||||
|
.map(s -> s + ",").collect(Collectors.joining()))
|
||||||
|
.append("...]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
builder.append(']');
|
builder.append(']');
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue