Created
September 25, 2013 08:43
-
-
Save ochilab/6696805 to your computer and use it in GitHub Desktop.
SynchronizedRPCMethodControllerの使い方
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SynchronizedRPCMethodController t = new SynchronizedRPCMethodController(10); | |
@UiHandler("button") | |
void onButtonClick(ClickEvent event) { | |
SynchronizedMethodHandler[] recall = new SynchronizedMethodHandler[2]; | |
t.start();//必ず呼ぶ | |
t.add(new SynchronizedMethodHandler(){ | |
public void run() { | |
System.out.println("前処理"); | |
rpcMethod(); | |
}}); | |
t.add(new SynchronizedMethodHandler(){ | |
public void run() { | |
System.out.println("1が終わり。"); | |
rpcMethod2(); | |
}}); | |
t.add(new SynchronizedMethodHandler(){ | |
public void run() { | |
System.out.println("2が終わり。"); | |
rpcMethod3(); | |
}}); | |
t.add(new SynchronizedMethodHandler(){ | |
public void run() { | |
System.out.println("後処理"); | |
t.end();//最後の処理には必ずt.end()をいれること | |
}}); | |
//以降には何も書いてはいけない(先に進んでしまいます。) | |
} | |
private void rpcMethod(){ | |
GreetingServiceAsync service = GWT.create(GreetingService.class); | |
//RPC処理 | |
service.method1("", new AsyncCallback<String>() { //XXXXのところは変更 | |
public void onSuccess(String result) { | |
// RPC呼び出しが成功したときの処理 | |
System.out.println("Success1"); | |
t.next();//必須です。 | |
} | |
public void onFailure(Throwable caught) { | |
//RPC呼び出しが失敗したときの処理 | |
} | |
}); | |
} | |
private void rpcMethod2(){ | |
GreetingServiceAsync service = GWT.create(GreetingService.class); | |
//RPC処理 | |
service.method2("", new AsyncCallback<String>() { //XXXXのところは変更 | |
public void onSuccess(String result) { | |
// RPC呼び出しが成功したときの処理 | |
System.out.println("Success2"); | |
t.next();//必須です。 | |
} | |
public void onFailure(Throwable caught) { | |
//RPC呼び出しが失敗したときの処理 | |
} | |
}); | |
} | |
private void rpcMethod3(){ | |
GreetingServiceAsync service = GWT.create(GreetingService.class); | |
//RPC処理 | |
service.method3("", new AsyncCallback<String>() { //XXXXのところは変更 | |
public void onSuccess(String result) { | |
// RPC呼び出しが成功したときの処理 | |
System.out.println("Success3"); | |
t.next();//必須です。 | |
} | |
public void onFailure(Throwable caught) { | |
//RPC呼び出しが失敗したときの処理 | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment