@Override public void runTimer() throws Exception { if (index.traceOptimisticLockErrors) { tasks.defaultExecutor().fork(this::cleanOldRecordings); } }
@Override public synchronized void runTimer() throws Exception { tasks.defaultExecutor().start(this::collectMetrics); }
@Override public void runTimer() throws Exception { tasks.defaultExecutor().start(this::runEviction); }
/** * Performs a re-index of all indices into new ones starting with the given index prefix instead of the * currently active one. * * @param prefix the new index prefix to use */ public void reIndex(String prefix) { final String newPrefix = prefix.endsWith("-") ? prefix : prefix + "-"; access.tasks.defaultExecutor().fork(new ReIndexTask(this, newPrefix)); }
@Override public void runTimer() throws Exception { tasks.defaultExecutor().start(() -> Sirius.getSetup().cleanOldLogFiles(logFileRetention.toMillis())); } }
private static void stopLifecycleParticipants() { LOG.INFO("Stopping lifecycles..."); LOG.INFO(SEPARATOR_LINE); for (int i = lifecycleStopParticipants.size() - 1; i >= 0; i--) { Stoppable stoppable = lifecycleStopParticipants.get(i); Future future = tasks.defaultExecutor().fork(() -> stopLifecycle(stoppable)); if (!future.await(Duration.ofSeconds(10))) { LOG.WARN("Lifecycle '%s' did not stop within 10 seconds....", stoppable.getClass().getName()); } } LOG.INFO(SEPARATOR_LINE); }
private static void startComponents() { if (started) { stop(); } boolean startFailed = false; for (final Startable lifecycle : lifecycleStartParticipants) { Future future = tasks.defaultExecutor().fork(() -> startLifecycle(lifecycle)); if (!future.await(Duration.ofMinutes(1))) { LOG.WARN("Lifecycle '%s' did not start within one minute....", lifecycle.getClass().getName()); startFailed = true; } } if (startFailed) { outputActiveOperations(); } started = true; }
@Override public void started() { databases.clear(); requiredSchemaChanges.clear(); Set<String> realms = mixing.getDesciptors() .stream() .filter(ed -> SQLEntity.class.isAssignableFrom(ed.getType())) .map(EntityDescriptor::getRealm) .collect(Collectors.toSet()); for (String realm : realms) { Extension ext = Sirius.getSettings().getExtension(EXTENSION_MIXING_JDBC, realm); if (ext.isDefault()) { OMA.LOG.INFO("Mixing is disabled for realm '%s' no configuration is present...", realm); } else { String databaseName = ext.get(KEY_DATABASE).asString(); if (dbs.hasDatabase(databaseName)) { Database primary = dbs.get(databaseName); databases.put(realm, Tuple.create(primary, determineSecondary(ext).orElse(primary))); waitForDatabaseToBecomeReady(realm, ext.get("initSql").asString()); } else { OMA.LOG.INFO( "Mixing is disabled for realm '%s' as the database '%s' is not present in the configuration...", realm, databaseName); } } } tasks.defaultExecutor().fork(this::updateSchemaAtStartup); }