Fix running clusteraware scheduled tasks in Wildfly after legacy migration

As the parent class is in another module, the protected field "task" is not accessible from the lambda.

Closes #13396
This commit is contained in:
Alexander Schwartz 2022-08-17 11:17:22 +02:00 committed by Bruno Oliveira da Silva
parent ec4b1c0158
commit 801b20e037

View file

@ -49,11 +49,13 @@ public class ClusterAwareScheduledTaskRunner extends ScheduledTaskRunner {
ClusterProvider clusterProvider = session.getProvider(ClusterProvider.class);
String taskKey = task.getClass().getSimpleName();
// copying over the value as parent class is in another module that wouldn't allow access from the lambda in Wildfly
ScheduledTask localTask = this.task;
ExecutionResult<Void> result = clusterProvider.executeIfNotExecuted(taskKey, intervalSecs, new Callable<Void>() {
@Override
public Void call() throws Exception {
task.run(session);
localTask.run(session);
return null;
}