I have found the bug. In my method I must send some objects to backend. These objects must implement Serializeable.
GWT Asnyccall can not be executed
Domanda
I have written a few Asynccall to run something in Server. They work fine. But some tasks need a long time to run. I want to know their status during the execution. Then I write the new Asynccall that sends query periodically to server to check the task's status. But for the Callback, I can get only the Failure Message. I have checked the log, this AsyncCallbak can not be executed. Can anyone give me some suggestion?
private BackendRemoteServiceAsync service = GWT.create(BackendRemoteService.class);
Timer timer = new Timer() {
public void run() {
try {
ApplicationController controller = ApplicationController
.getInstance();
BackendRequest request = new BackendRequest(
Command.COMMAND_TASK_CHECKSTATUS,
controller.getSessionToken());
request.setDomain(Domains.TASK);
...
service.callBackend(request, new AsyncCallback<BackendRequest>() {
public void onFailure(Throwable caught) {
task.setStatus("check status failure");
}
public void onSuccess(BackendRequest result) {
if (result.isValid()) {
task.setStatus("check status Success"); ...
} else
;
}
});
} catch (IllegalArgumentException ex) {
Window.alert("IllegalArgumentException: "+ ex.getMessage());
} catch (Throwable t) {
Window.alert(t.getMessage());
} finally {
}
}
};
timer.scheduleRepeating(5000);
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow