@Async Execution
To execute a command asynchronously, you can use the @Async
annotation.
Java
@Command(name = "async-command")
public class Example {
@Async
@Execute
void execute() {
System.out.print("This message is triggered asynchronously!");
}
}
IMPORTANT
The command will be executed in an asynchronous thread defined by scheduler.