-4

I have some scenario

  1. scheduler(call repeatedly) should call for a async function say fun().
  2. Controller should call same function fun() and return result based on successful completion(By checking exception)

Please provide me some skeleton with appropriate notations.

1 Answers1

0

You should have your method as sync, but if you want to call your async methd, inside of your async method you should call your sync method.

public void mySyncMethod(){
   //whatever you want. 
}

Async method

@Async
public void myAsyncMethod(){
   mySyncMethod();
}

I supposed you are using spring boot