use of org.commonjava.indy.core.expire.ExpirationSet in project indy by Commonjava.
the class IndySchedulerClientModule method getDisabledStoreTimeouts.
public Map<StoreKey, Date> getDisabledStoreTimeouts() throws IndyClientException {
ExpirationSet expSet = getHttp().get(UrlUtils.buildUrl(BY_STORE_BASE, ALL_STORES, DISABLE_TIMEOUT), ExpirationSet.class);
Logger logger = LoggerFactory.getLogger(getClass());
if (expSet == null) {
logger.debug("No disabled stores!");
return Collections.emptyMap();
}
Map<StoreKey, Date> result = new HashMap<>();
expSet.forEach((exp) -> {
logger.debug("Mapping expiration for group: {} (parts: {})", exp.getGroup(), Arrays.asList(exp.getGroup().split("\\s*#\\s*")));
String[] parts = exp.getGroup().split("\\s*#\\s*");
if (parts.length < 2) {
logger.warn("Skipping invalid store-disabled timeout group: '{}'", exp.getGroup());
} else {
StoreKey key = StoreKey.fromString(parts[0]);
logger.debug("{} -> {}", key, exp.getExpiration());
result.put(key, exp.getExpiration());
}
});
return result;
}
use of org.commonjava.indy.core.expire.ExpirationSet in project indy by Commonjava.
the class SchedulerController method getDisabledStores.
public ExpirationSet getDisabledStores() throws IndyWorkflowException {
try {
// This key matcher will compare with the cache key group to see if the group ends with the "Disable-Timeout"(jobtype)
ExpirationSet expirations = scheduleManager.findMatchingExpirations(StoreEnablementManager.DISABLE_TIMEOUT);
// TODO: This seems REALLY inefficient...
storeDataManager.getAllArtifactStores().forEach((store) -> {
if (store.isDisabled()) {
expirations.getItems().add(indefiniteDisable(store));
}
});
return expirations;
} catch (IndyDataException e) {
throw new IndyWorkflowException("Failed to load stores to check for indefinite disable. Reason: %s", e, e.getMessage());
}
}
Aggregations