@Override
protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) {
final AnnotationValueBuilder<?> builder = AnnotationValue.builder(Scheduled.class);
annotation.get("cron", String.class).ifPresent(s -> builder.member("cron", s));
// members that take numbers needed "ms" appending
annotation.get("fixedDelay", String.class).ifPresent(s -> builder.member("fixedDelay", s + "ms"));
annotation.get("fixedRate", String.class).ifPresent(s -> builder.member("fixedRate", s + "ms"));
annotation.get("initialDelay", String.class).ifPresent(s -> builder.member("initialDelay", s + "ms"));
annotation.get("fixedDelayString", String.class).ifPresent(s -> builder.member("fixedDelay", s));
annotation.get("fixedRateString", String.class).ifPresent(s -> builder.member("fixedRate", s));
annotation.get("initialDelayString", String.class).ifPresent(s -> builder.member("initialDelay", s));
final AnnotationValue<?> scheduledAnn = builder
.build();
return Collections.singletonList(scheduledAnn);
}
/**
* Send ka messages to active sessions.
*/
@Scheduled(fixedDelay =
"${" + GraphQLConfiguration.PREFIX + "." + GraphQLWsConfiguration.KEEP_ALIVE_INTERVAL + ":"
+ GraphQLWsConfiguration.DEFAULT_KEEP_ALIVE_INTERVAL + "}")
public void keepAliveSender() {
broadcaster.broadcastSync(kaMessage, state::isActive);
}
@Scheduled(fixedRate = "100ms")
@SchedulerLock(name = "reportCurrentTime")
public void reportCurrentTime() {
assertLocked();
called.set(true);
System.out.println(new Date());
}
@Scheduled(fixedRate = "8h")
public void importBankStatement() {
log.info("Starting bank statement import job");
inPaymentRegistrationService.registerInPayments(jobCfg.getImportDir(), LocalDate.now());
}