aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcConnectionPool.java
blob: a93ddb0b360e2c652d4bd8f9e1758d38112f4e28 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.dispatch.rpc;

import com.yahoo.vespa.config.search.DispatchNodesConfig;

import java.util.Collection;
import java.util.List;

/**
 * Interface for getting a connection given a node id.
 *
 * @author balderersheim
 */
public interface RpcConnectionPool extends AutoCloseable {

    /** Returns a connection to the given node id. */
    Client.NodeConnection getConnection(int nodeId);


    /** Will return a list of items that need a delayed close when updating node set. */
    default Collection<? extends AutoCloseable> updateNodes(DispatchNodesConfig nodesConfig) { return List.of(); }

    /** Shuts down all connections in the pool, and the underlying RPC client. */
    @Override
    void close();

}