aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/test/java/com/yahoo/jdisc/http/server/jetty/InMemoryConnectionLog.java
blob: 61ff357c11a807eb32c9e470637d4635bc07e733 (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 Vespa.ai. 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; }
}