When will the data variable here be qualified for garbage collection? And how jvm would know that this data variable has to be alive because my task is alive. The only thing my editor said is the variable needs to be final or effectively final. Ok I won't update it but still how will be the reference carried forwarded? Does java also has concept like closure of javascript or what process is it? I am asking for any official JVM specification documents or any credible source where I can get the information about what exactly happens in this situation.
public void schedule() {
String data = "adfasdf";
scheduler.newJob("businessruleid")
.setCron("0/5 * * * * ?")
.setTask(executionContext -> {
System.out.println(executionContext + " " + data);
}).schedule();
}