List of usage examples for org.springframework.scheduling.config ScheduledTaskRegistrar addFixedRateTask
public void addFixedRateTask(Runnable task, long interval)
From source file:it.infn.mw.iam.config.saml.SamlConfig.java
private void scheduleMetadataLookupServiceRefresh(ScheduledTaskRegistrar taskRegistrar) { LOG.info("Scheduling metadata lookup service refresh task to run every {} seconds.", samlProperties.getMetadataLookupServiceRefreshPeriodSec()); taskRegistrar.addFixedRateTask(() -> metadataLookupService.refreshMetadata(), TimeUnit.SECONDS.toMillis(samlProperties.getMetadataLookupServiceRefreshPeriodSec())); }
From source file:it.infn.mw.iam.config.saml.SamlConfig.java
private void scheduleProvisionedAccountsCleanup(final ScheduledTaskRegistrar taskRegistrar) { if (!jitProperties.getEnabled()) { LOG.info("Just-in-time account provisioning for SAML is DISABLED."); return;/*from ww w. j a v a 2s . c o m*/ } if (!jitProperties.getCleanupTaskEnabled()) { LOG.info("Cleanup for SAML JIT account provisioning is DISABLED."); return; } LOG.info( "Scheduling Just-in-time provisioned account cleanup task to run every {} seconds. Accounts inactive for {} " + "days will be deleted", jitProperties.getCleanupTaskPeriodSec(), jitProperties.getInactiveAccountLifetimeDays()); taskRegistrar.addFixedRateTask( new CleanInactiveProvisionedAccounts(new SystemTimeProvider(), accountService, jitProperties.getInactiveAccountLifetimeDays()), TimeUnit.SECONDS.toMillis(jitProperties.getCleanupTaskPeriodSec())); }