use of io.quarkus.scheduler.Scheduled in project apicurio-registry by Apicurio.
the class LogConfigurationService method checkLogLevel.
@Scheduled(concurrentExecution = ConcurrentExecution.SKIP, delayed = "{registry.logconfigjob.delayed}", every = "{registry.logconfigjob.every}")
public void checkLogLevel() {
if (!storage.isAlive() || !storage.isReady()) {
return;
}
LOGGER.trace("Running periodic log configuration process");
for (LogConfigurationDto logConfig : storage.listLogConfigurations()) {
Logger logger = Logger.getLogger(logConfig.getLogger());
Level expectedLevel = Level.parse(logConfig.getLogLevel().value());
if (!getLogLevel(logger).equals(expectedLevel)) {
LOGGER.info(String.format("Updating logger %s to log level %s", logConfig.getLogger(), logConfig.getLogLevel().value()));
logger.setLevel(expectedLevel);
}
if (logConfig.getLogLevel().value().equals(defaultLogLevel)) {
LOGGER.info(String.format("Cleaning persisted config for logger %s because default log level is configured %s", logConfig.getLogger(), logConfig.getLogLevel().value()));
storage.removeLogConfiguration(logConfig.getLogger());
}
}
}
use of io.quarkus.scheduler.Scheduled in project apicurio-registry by Apicurio.
the class TenantReaper method run.
/**
* Minimal granularity is 1 minute.
*/
@Scheduled(concurrentExecution = SKIP, every = "{registry.multitenancy.reaper.every}")
void run() {
if (!properties.isMultitenancyEnabled()) {
return;
}
final Instant now = Instant.now();
if (now.isAfter(next)) {
try {
log.debug("Running tenant reaper job at {}", now);
reap();
// Only force cache invalidation if the reaper period is less than 1 minute (testing support).
if (properties.getReaperPeriod().compareTo(Duration.ofSeconds(60)) < 0) {
tcl.invalidateTenantCache();
}
} catch (Exception ex) {
log.error("Exception thrown when running tenant reaper job", ex);
} finally {
next = now.plus(properties.getReaperPeriod());
log.debug("Running next tenant reaper job at around {}", next);
}
}
}
use of io.quarkus.scheduler.Scheduled in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class WorkManagerImpl method reconnectDroppedWorkers.
@SuppressWarnings("unused")
@Transactional
@Scheduled(every = "5m", concurrentExecution = Scheduled.ConcurrentExecution.SKIP)
void reconnectDroppedWorkers() {
ZonedDateTime age = ZonedDateTime.now().minusMinutes(5);
workDAO.reconnectDroppedWorkers(workerIdProvider.getWorkerId(), age);
}
use of io.quarkus.scheduler.Scheduled in project openk9 by smclab.
the class TenantRegistry method initializeTenantMap.
@Scheduled(every = "30s")
@Blocking
void initializeTenantMap() {
List<Tenant> listTenant = Tenant.<Tenant>list("active = true").await().indefinitely();
Map<String, Tenant> map = new HashMap<>(listTenant.size());
for (Tenant tenant : listTenant) {
map.put(tenant.getVirtualHost(), tenant);
}
_tenantMap.clear();
_tenantMap.putAll(map);
}
use of io.quarkus.scheduler.Scheduled in project policies-ui-backend by RedHatInsights.
the class ProcSelfStatusExporter method gather.
@Scheduled(every = "10s")
void gather() {
File status = new File(PATHNAME);
if (!status.exists() || !status.canRead()) {
if (!hasWarned) {
log.warning("Can't read " + PATHNAME);
hasWarned = true;
}
return;
}
try (Scanner fr = new Scanner(status)) {
while (fr.hasNextLine()) {
String line = fr.nextLine();
String[] parts = line.split("[ \t]+");
switch(parts[0]) {
case "VmHWM:":
vmHwm = Long.parseLong(parts[1]);
break;
case "VmRSS:":
vmRss = Long.parseLong(parts[1]);
break;
case "RssAnon:":
rssAnon = Long.parseLong(parts[1]);
break;
case "RssFile:":
rssFile = Long.parseLong(parts[1]);
break;
case "VmStk:":
vmStk = Long.parseLong(parts[1]);
break;
case "VmLib:":
vmLib = Long.parseLong(parts[1]);
break;
case "VmData:":
vmData = Long.parseLong(parts[1]);
break;
case "VmSize:":
vmSize = Long.parseLong(parts[1]);
break;
case "Threads:":
threads = Integer.parseInt(parts[1]);
break;
default:
}
}
} catch (Exception e) {
log.warning("Reading failed: " + e.getMessage());
}
}
Aggregations