use of com.yahoo.vespa.hosted.controller.rotation.RotationLock in project vespa by vespa-engine.
the class DnsMaintainer method maintain.
@Override
protected void maintain() {
try (RotationLock lock = rotationRepository().lock()) {
Map<RotationId, Rotation> unassignedRotations = rotationRepository().availableRotations(lock);
unassignedRotations.values().forEach(this::removeDnsAlias);
}
}
use of com.yahoo.vespa.hosted.controller.rotation.RotationLock in project vespa by vespa-engine.
the class ApplicationController method withRotation.
/**
* Makes sure the application has a global rotation, if eligible.
*/
private LockedApplication withRotation(LockedApplication application, ZoneId zone) {
if (zone.environment() == Environment.prod && application.deploymentSpec().globalServiceId().isPresent()) {
try (RotationLock rotationLock = rotationRepository.lock()) {
Rotation rotation = rotationRepository.getRotation(application, rotationLock);
application = application.with(rotation.id());
// store assigned rotation even if deployment fails
store(application);
registerRotationInDns(rotation, application.rotation().get().dnsName());
registerRotationInDns(rotation, application.rotation().get().secureDnsName());
}
}
return application;
}
use of com.yahoo.vespa.hosted.controller.rotation.RotationLock in project vespa by vespa-engine.
the class MetricsReporter method reportRemainingRotations.
private void reportRemainingRotations() {
try (RotationLock lock = controller().applications().rotationRepository().lock()) {
int availableRotations = controller().applications().rotationRepository().availableRotations(lock).size();
metric.set(remainingRotations, availableRotations, metric.createContext(Collections.emptyMap()));
}
}
Aggregations