blob: 6f06a2ac22e26821d3469d2d43bf3a45c5489780 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.maintenance;
import com.yahoo.jdisc.Metric;
import com.yahoo.vespa.hosted.provision.Node;
import com.yahoo.vespa.hosted.provision.NodeRepository;
import com.yahoo.vespa.hosted.provision.node.Agent;
import com.yahoo.vespa.hosted.provision.node.History;
import java.time.Duration;
import java.util.List;
/**
* Maintenance job which moves reserved nodes to dirty after timeout.
* Nodes need to time out in case someone reserves nodes (by calling prepare) but never commits.
* reserved nodes may in some cases come from the inactive state, in which case they are dirty.
* For this reason, all reserved nodes go through the dirty state before going back to ready.
*
* @author bratseth
*/
public class ReservationExpirer extends Expirer {
public ReservationExpirer(NodeRepository nodeRepository, Duration reservationPeriod, Metric metric) {
super(Node.State.reserved, History.Event.Type.reserved, nodeRepository, reservationPeriod, metric);
}
@Override
protected void expire(List<Node> expired) { nodeRepository().nodes().deallocate(expired, Agent.ReservationExpirer, "Expired by ReservationExpirer"); }
}
|