use of com.yahoo.vespa.curator.Lock in project vespa by vespa-engine.
the class TenantController method updateTenant.
public void updateTenant(Tenant updatedTenant, Optional<NToken> token) {
try (Lock lock = lock(updatedTenant.getId())) {
if (!tenant(updatedTenant.getId()).isPresent())
throw new IllegalArgumentException("Could not update " + updatedTenant + ": Tenant does not exist");
if (updatedTenant.isAthensTenant() && !token.isPresent())
throw new IllegalArgumentException("Could not update " + updatedTenant + ": No NToken provided");
updateAthenzDomain(updatedTenant, token);
db.updateTenant(updatedTenant);
log.info("Updated " + updatedTenant);
} catch (PersistenceException e) {
throw new RuntimeException(e);
}
}
use of com.yahoo.vespa.curator.Lock in project vespa by vespa-engine.
the class JobControl method setActive.
/**
* Set a job active or inactive
*/
public void setActive(String jobSimpleClassName, boolean active) {
try (Lock lock = db.lockInactiveJobs()) {
Set<String> inactiveJobs = db.readInactiveJobs();
if (active)
inactiveJobs.remove(jobSimpleClassName);
else
inactiveJobs.add(jobSimpleClassName);
db.writeInactiveJobs(inactiveJobs);
}
}
Aggregations