GWT 使 RPC 阻塞
是否可以使 gwt rpc 阻塞?即应用程序阻塞,直到收到服务器的响应
Is it possible to make a gwt rpc blocking? i.e. the application blocks until a response is received from the server
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我所知,没有 gwt rpc 阻塞,因为它与异步回调的想法相反。
但是你可以使用Timer这两个方法
onSuccess()
方法中执行所有操作。它保证您的方法已完成并成功完成,然后继续其他方法。我的建议是第二个(onSuccess)。我想再次提一下,阻塞从来都不是一个好主意
As far as I know there is no gwt rpc blocking because it is opposite idea to the asynchronous callback.
But you can use these two methods
onSuccess()
method. It guarantees that your method is finished and successfully finished then continue to other methods.My advise is 2nd one (onSuccess). I want to mention again that blocking is never a good idea
嗯,同步 rpc 调用被 GWT 设计者称为邪恶。他们确实有非常有力的论据...但是你可以通过 hacks 成功同步 rpc..这是其中之一,
http://code.google.com/p/google -web-toolkit/issues/detail?id=4898
Well, synchronus rpc calls are called as evils by GWT designers. They do have very strong arguments... But you can succeed synchronous rpc by means of hacks..Here is one of them,
http://code.google.com/p/google-web-toolkit/issues/detail?id=4898
我想到的最简单的解决方案是从异步调用开始的地方“阻止”您的应用程序,直到填充完成,这将在
onSuccess()
方法的末尾。我所说的阻止只是为了在中间显示一些 动画加载 gif页面。
The most simple solution that came to my mind would be to "block" your application from the point where the Asynchronous call starts till the filling is completed, which would be at the end of the
onSuccess()
method.By blocking I mean just to show some animated loading gif in the middle of the page.