Fix bug in trace repository
When reverse==false we have to be careful to remove the right element when capacity is reached.
This commit is contained in:
@@ -63,7 +63,7 @@ public class InMemoryTraceRepository implements TraceRepository {
|
||||
Trace trace = new Trace(new Date(), map);
|
||||
synchronized (this.traces) {
|
||||
while (this.traces.size() >= this.capacity) {
|
||||
this.traces.remove(this.capacity - 1);
|
||||
this.traces.remove(this.reverse ? this.capacity - 1 : 0);
|
||||
}
|
||||
if (this.reverse) {
|
||||
this.traces.add(0, trace);
|
||||
|
||||
Reference in New Issue
Block a user