aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/ClientState.java
blob: a686f6cf5da5096e73af8975fa55e223f9200ebd (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.server;

import com.yahoo.jdisc.Metric;
import com.yahoo.jdisc.ReferencedResource;
import com.yahoo.messagebus.shared.SharedSourceSession;

import java.util.concurrent.BlockingQueue;

/**
 * The state of a client session, used to save replies when client disconnects.
 *
 * @author Steinar Knutsen
 */
public class ClientState {

    public final int pending;
    public final long creationTime;
    public final BlockingQueue<OperationStatus> feedReplies;
    public final ReferencedResource<SharedSourceSession> sourceSession;
    public final Metric.Context metricContext;

    public final long prevOpsPerSecTime; // previous measurement time of OPS
    public final double operationsForOpsPerSec;

    public ClientState(int pending, BlockingQueue<OperationStatus> feedReplies,
                ReferencedResource<SharedSourceSession> sourceSession, Metric.Context metricContext,
                long prevOpsPerSecTime, double operationsForOpsPerSec) {
        super();
        this.pending = pending;
        this.feedReplies = feedReplies;
        this.sourceSession = sourceSession;
        this.metricContext = metricContext;
        creationTime = System.currentTimeMillis();
        this.prevOpsPerSecTime = prevOpsPerSecTime;
        this.operationsForOpsPerSec = operationsForOpsPerSec;
    }

}