aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/InMemoryConnectionLog.java
blob: 80fb2ebbbbe2bb03adb29e768b16b4beb97ae0ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.http.server.jetty;

import com.yahoo.container.logging.ConnectionLog;
import com.yahoo.container.logging.ConnectionLogEntry;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * A {@link ConnectionLog} that aggregates log entries in memory
 *
 * @author bjorncs
 */
class InMemoryConnectionLog implements ConnectionLog {

    private final List<ConnectionLogEntry> logEntries = new CopyOnWriteArrayList<>();

    @Override
    public void log(ConnectionLogEntry entry) {
        logEntries.add(entry);
    }

    List<ConnectionLogEntry> logEntries() { return logEntries; }
}