I have the following codes which is executed every 3 seconds asynchronously
<Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
@Override
public boolean execute() {
try {
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, "someurl");
Request response = builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
}
public void onResponseReceived(Request request, Response response) {
// do some work
}
});
} catch (RequestException e) {}
return true;
}
}, 3000);
And the below code which takes long time to proceed.
try {
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, "someurl");
Request response = builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
}
public void onResponseReceived(Request request, Response response) {
// do some work which takes long time to finish
}
});
} catch (RequestException e) {}
i was expecting the scheduler will make a call in every 3 seconds, but when the other call that takes more time to finish then the call inside scheduler gets blocked which supposed not be as all are asynchronous call.
please let me know if anything wrong in the above scenario.