Add missing synchronization
This commit is contained in:
parent
187a5976cc
commit
5b68996f5a
@ -295,22 +295,24 @@ public final class ResourceLeakDetector<T> {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder buf = new StringBuilder(16384);
|
Object[] array;
|
||||||
int lastRecordCount = lastRecords.size();
|
synchronized (lastRecords) {
|
||||||
|
array = lastRecords.toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder buf = new StringBuilder(16384);
|
||||||
buf.append(NEWLINE);
|
buf.append(NEWLINE);
|
||||||
buf.append("Recent access records: ");
|
buf.append("Recent access records: ");
|
||||||
buf.append(lastRecordCount);
|
buf.append(array.length);
|
||||||
buf.append(NEWLINE);
|
buf.append(NEWLINE);
|
||||||
|
|
||||||
if (lastRecordCount > 0) {
|
if (array.length > 0) {
|
||||||
String[] lastRecords = this.lastRecords.toArray(new String[lastRecordCount]);
|
for (int i = array.length - 1; i >= 0; i --) {
|
||||||
for (int i = lastRecords.length - 1; i >= 0; i --) {
|
|
||||||
buf.append('#');
|
buf.append('#');
|
||||||
buf.append(i + 1);
|
buf.append(i + 1);
|
||||||
buf.append(':');
|
buf.append(':');
|
||||||
buf.append(NEWLINE);
|
buf.append(NEWLINE);
|
||||||
buf.append(lastRecords[i]);
|
buf.append(array[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user