JAVA custom code return null

hi, i switch from php framework to java and this work well but i have a problem. if i create a custom event this return null to javascript function.
in the server i put a timer o 10 seconds and I noticed that the success response to the client does not arrive after 10 seconds, but instantly. why it does not return any objects, .
I need to respond to the client only once the function in the server has completed its work
CLIENT

var eventArgs = {
 title: "ciao",
 caption: "null",
 target: 0,
 likeCounter: 0
 };


var successHandler = function(response){
 console.log(response);
 };


 var errorHandler = function(response){
 console.log(response);
 };


 Backendless.Events.dispatch("CreateEvent", eventArgs, new Backendless.Async(successHandler, errorHandler));

SERVER

@BackendlessEvent( "CreateEvent" )
public class CreateEventEventHandler extends com.backendless.servercode.extension.CustomEventHandler
{


 @Async
 @Override
 public Map handleEvent(RunnerContext context, Map eventArgs)
 {
 System.out.println(eventArgs.toString());


 try {
 Thread.sleep(10000);
 } catch (InterruptedException e) {
 e.printStackTrace();
 }
 System.out.println(context.toString());
 return eventArgs;
 }
 
}

in the server the println function stamp the arguments well before and after the timer

If you remove “@Async” from your server-side code, it will be running synchronously and your client-side will get the response.

Regards,
Mark

thanks now work :slight_smile: