GWT RPC Call从另一个GWT RPC调用中获取返回对象 [英] GWT RPC Call gets return object from another GWT RPC call

查看:222
本文介绍了GWT RPC Call从另一个GWT RPC调用中获取返回对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的问题(希望你能帮忙):我正在研究一个GWT Web应用程序,它有时候会在同一时间内完成超过4 - 5个GWT RPC调用 - 就时间而言。



每过一段时间 - 每15次电话一次?来自一个调用的返回对象,被分配给另一个。我通过在客户端使用gwt-log库证明了这一点。



这里HistoryChangesCount调用的返回对象也被分配给了modelingGetTemplates调用。 / p>

因此,在执行调用的客户端文件中产生ClassCastException,与onSuccess方法在同一行。



你有什么技巧可以避免这种情况吗?



PS - 我在错误级别记录每个响应object.toString()。我知道这不是最佳做法。

  [14:38:01.026]( -  :-) 2014-04-03 14:38 :01,025 [ERROR] getHistoryChangesCount  -  HistoryPreviewFacet  -  SUCCESS RETURNED:HistoryChangesCount {dateToNumberOfChangesMap = {Mon Mar 31 03:00:00 GMT + 300 2014 = 3},lastUpdatedOn = Mon Mar 31 11:11:02 GMT + 300 2014} $ b $  -  b
[14:38:01.163]( - :-) 2014-04-03 14:38:01,162 [错误] modelingGetTemplates - ModelingTemplatesDropdown - SUCCESS RETURNED:HistoryChangesCount {dateToNumberOfChangesMap = {Mon Mar 31 03: 00:00 GMT + 300 2014 = 3},lastUpdatedOn = Mon Mar 31 11:11:02 GMT + 300 2014}

[14:38:01.175]( - :-) 2014- 04-03 14:38:01,174 [错误]浏览器:null
Unknown.iCb中的
(StackTraceCreator.java:174)Unknown.sd中的
(StackTraceCreator.java :508)
在Unknown.Txn(Throwable.java:46)
在Unknown.kIc(Cast.java:46)
在Unknown.rff(ModelingTemplatesDropdown.java:79)
在Unknown.bXi(AsyncWrapperForRPCManager.java:38)
在Unknown.Loe(RequestCallbackAdapter.java:232)
在Unknown.MWb(Request.java:258)
在Unknown.qXb(RequestBuilder.java:412)
在Unknown.anonymous(在Unknown.eBb上的
(Impl.java:189)在Unknown.hBb上的
(Impl.java:242)在Unknown.anonymous上的
(Impl.java:70 )

以下是对modelingGetTemplates的成功调用的样子:

( - :-) 2014-04-03 14:37:24,932 [错误] modelingGetTemplates - ModelingTemplatesDropdown - SUCCESS RETURNED:[高级商业应用,高级商业交易,TestTemplate]

我是使用香草GWT-RPC。我只有一个扩展AsyncWrapper以进行日志记录的类。我还创建了自己的客户端队列,将并行调用数量限制为4,但即便如此,它仍然会发生。



版本:
GWT:2.5。 1
,我也使用Sencha GXT,不确定是否相关。

这是一个复制问题的视频 - 在0:30 - 这次另一个调用从modelingGetTemplates获得对象。



最终的结果是,我的小部件永远无法加载等待数据。当然,愤怒的用户:)解决方案

找不到修复程序)

我创建了一个客户端GWT RPC调用队列。
由用户界面进行的任何RPC调用都是对队列的调用进行注册,并且队列将管理(在高负载,读取延迟期间)调用的实际执行。



它的作用类似于线程池。我有一次可以同时接听多少个并行呼叫,还有两次呼叫之间的最小时间间隔。我相信它最终设置为200毫秒。



所以通过上述我(几乎)从来没有得到过这个问题。

我对以下原因的猜测:



我相信GWT框架有一些地图使用一个取决于调用时间戳的键,如果两个调用同时发生,地图可以切换调用,将结果搞乱调用映射。


I have a strange issue (hope you can help): I am working on a GWT Web Application that has times when more than 4 - 5 GWT RPC calls are made in the same time - as far as time is concerned.

Every once in a while - once every 15 calls maybe? The return Object from one call, gets 'assigned' to another. I have proof of this by using the gwt-log library on the client side.

Here the return object of the HistoryChangesCount call, got assigned to the modelingGetTemplates call also.

Thus resulting in a ClassCastException in the client file that made the call, on the same line as the onSuccess method.

Do you have any tips on how I can avoid this?

PS - I log every response object.toString() on error level. I know it's not best practice. It's just for troubleshooting.

[14:38:01.026] "(-:-) 2014-04-03 14:38:01,025 [ERROR] getHistoryChangesCount - HistoryPreviewFacet - SUCCESS RETURNED: HistoryChangesCount{dateToNumberOfChangesMap={Mon Mar 31 03:00:00 GMT+300 2014=3}, lastUpdatedOn=Mon Mar 31 11:11:02 GMT+300 2014}
"
[14:38:01.163] "(-:-) 2014-04-03 14:38:01,162 [ERROR] modelingGetTemplates - ModelingTemplatesDropdown - SUCCESS RETURNED: HistoryChangesCount{dateToNumberOfChangesMap={Mon Mar 31 03:00:00 GMT+300 2014=3}, lastUpdatedOn=Mon Mar 31 11:11:02 GMT+300 2014}
"
[14:38:01.175] "(-:-) 2014-04-03 14:38:01,174 [ERROR] Browser: null
java.lang.ClassCastException
    at Unknown.iCb(StackTraceCreator.java:174)
    at Unknown.sd(StackTraceCreator.java:508)
    at Unknown.Txn(Throwable.java:46)
    at Unknown.kIc(Cast.java:46)
    at Unknown.rff(ModelingTemplatesDropdown.java:79)
    at Unknown.bXi(AsyncWrapperForRPCManager.java:38)
    at Unknown.Loe(RequestCallbackAdapter.java:232)
    at Unknown.MWb(Request.java:258)
    at Unknown.qXb(RequestBuilder.java:412)
    at Unknown.anonymous(XMLHttpRequest.java:351)
    at Unknown.eBb(Impl.java:189)
    at Unknown.hBb(Impl.java:242)
    at Unknown.anonymous(Impl.java:70)
"

Here is how a successful call to modelingGetTemplates looks like:

[14:37:24.933] "(-:-) 2014-04-03 14:37:24,932 [ERROR] modelingGetTemplates - ModelingTemplatesDropdown - SUCCESS RETURNED: [Advanced Business Application, Advanced Business Transaction, TestTemplate]
"

I am using vanilla GWT-RPC. I only have a class that extends AsyncWrapper for logging. I also created myself a client side queue that limits the number of parallel calls to 4, but even so it still happens.

Versions: GWT: 2.5.1 and I also use Sencha GXT, not sure if relevant.

Here is a video of the issue reproducing - at 0:30 - this time another call get's the object from modelingGetTemplates.

The end result is that my widget is stuck on loading waiting for data forever. And of course angry users :)

解决方案

Documenting the way I got around this, rather than fixing it :) (because I couldn't find a fix)

I created a client side GWT RPC call queue. Any RPC call made by the UI was registring the call to the queue, and the queue would manage (during high load, read delay), the actual execution of the calls.

It acted similar to a thread pool. I had a constant of how many parallel calls I can have at one time, and also a minimum time interval between two calls. I believe it was eventually set to 200 milliseconds.

So by doing the above I (almost) never got that issue. The frequency was so low, nobody noticed it anymore.

My guess of the cause below:

I believe the GWT framework has some maps that use a key that depends on the timestamp of the calls, and if two calls happen at the same time, the map could switch the calls, messing up the results to calls mapping.

这篇关于GWT RPC Call从另一个GWT RPC调用中获取返回对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆