aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextSupplier.java
blob: a44506267664e34a6557bd2231b8f572f9057d22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.nodeagent;

/**
 * @author freva
 */
public interface NodeAgentContextSupplier {

    /**
     * Blocks until the next context is ready
     * @return context
     * @throws ContextSupplierInterruptedException if {@link #interrupt()} was called before this method returned
     */
    NodeAgentContext nextContext() throws ContextSupplierInterruptedException;

    /** Interrupts the thread(s) currently waiting in {@link #nextContext()} */
    void interrupt();

    class ContextSupplierInterruptedException extends RuntimeException { }
}