if (asyncReturnType != JPrimitiveType.VOID)
{
logger.log(TreeLogger.ERROR, "UseSynchronizer Token only can be used with void return type on Async interface.");
throw new UnableToCompleteException();
}
UseSynchronizerToken synchronizerTokenAnnot = syncMethod.getAnnotation(UseSynchronizerToken.class);
boolean blocksScreen = synchronizerTokenAnnot.blocksUserInteraction();
JParameter parameter = parameters.get(parameters.size()-1);
srcWriter.println("final String methodDesc = \""+JClassUtils.getMethodDescription(syncMethod)+"\";");
srcWriter.println("if (__startMethodCall(methodDesc, "+blocksScreen+")){");
srcWriter.indent();
srcWriter.println("__syncTokenService.getSynchronizerToken(methodDesc,");
srcWriter.println("new AsyncCallback<String>(){");
srcWriter.indent();
srcWriter.println("public void onSuccess(String result){");
srcWriter.indent();
srcWriter.println("__updateMethodToken(methodDesc, result);");
generateProxyMethodCall(srcWriter, asyncMethod, parameters, "methodDesc", blocksScreen);
srcWriter.outdent();
srcWriter.println("}");
srcWriter.println("public void onFailure(Throwable caught){");
srcWriter.indent();
srcWriter.println("try{");
srcWriter.println(parameter.getName()+".onFailure(caught);");
srcWriter.println("}finally{");
srcWriter.println("__endMethodCall(methodDesc, "+blocksScreen+");");
srcWriter.println("}");
srcWriter.outdent();
srcWriter.println("}");
srcWriter.outdent();
srcWriter.println("});");
srcWriter.outdent();
srcWriter.println("}");
if (synchronizerTokenAnnot.notifyCallsWhenProcessing())
{
srcWriter.println("else{");
srcWriter.indent();
String sensitiveErrMsg = Crux.class.getName() + ".getMessages().methodIsAlreadyBeingProcessed()";