开发者

GWT serversided threads

开发者 https://www.devze.com 2023-02-23 05:01 出处:网络
I\'m using the GWT RPC calls to talk to another server. I do this asynchronous by using threads. So the RPC service is returning before all threads are finished.

I'm using the GWT RPC calls to talk to another server. I do this asynchronous by using threads. So the RPC service is returning before all threads are finished.

My problem now is that the HttpURLConnection I use, works fine when I use it woutjout thread, but crashes when I use it in a seperate thread. The reason for that I is (I think) beache the RPC call is returning before al threads are finished.

Did anybody 开发者_如何学运维had the same problem and found a solution for it?

best regards, Stefan


If your assumption that the crash is being caused by the RPC call returning too soon, you could use Thread.join() on each of the threads you created to work asynchronously. This will block the main thread until all your background work is done.

0

精彩评论

暂无评论...
验证码 换一张
取 消