Following code snipped:
public String[] getCompletionItems(String str){
System.out.println("Zeile 26");
AsyncCallback callback = new AsyncCallback() {
public void onSuccess (Object result)
{
System.out.println("Zeile 30");
s = (String[])result;
}
public void onFailure (Throwable ex)
{
//RootPanel.get().add(new HTML(ex.toString()));
RootPanel.get("autocomp").add(new HTML(ex.toString()));
}
};
async.getAutocompletion(str, callback);
System.out.println("Zeile 41");
return s;
}
Output:
Zeile 26
Zeile 41
Zeile 30
So for the return value I always get the value from the last call of
the method. How can I assure, that the RPC method is called and answer
is waited for? I hope someone has a some good advice.
rapsli
You can't. GWT's RPC mechanism is _asynchronous_. You set up the
call with an associated handler, and then you issue the call. When
the browser is done receiving the response it will eventually get
around to calling your handler. You have no control over when that
will be, but you can be sure it'll be sometime "in the future" and it
will happen after the function that issues the call has returned.
Ian
--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com
button.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
image.setVisible(true);
TestSynchronousAsync testSynchronous =
TestSynchronous.Util.getInstance();
AsyncCallback asyncCallback = new AsyncCallback(){
public void onFailure(Throwable caught) {
image.setVisible(false);
}
public void onSuccess(Object result) {
image.setVisible(false);
}};
testSynchronous.sayHello(asyncCallback);
}});
Rapsli
> > > rapsli- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -