开发者

GWT - Reusing Callback Class

开发者 https://www.devze.com 2023-01-03 07:32 出处:网络
My custom callback class implements AsyncCallback (like MyA开发者_运维技巧syncCallback implements AsyncCallback) and planning use single instance of MyAsyncCallback for multiple rpc method executions.

My custom callback class implements AsyncCallback (like MyA开发者_运维技巧syncCallback implements AsyncCallback) and planning use single instance of MyAsyncCallback for multiple rpc method executions. Is this approach safe?. Or should have to create new instance of MyAsyncCallback for every interaction from browser to server?.

I am kind of tired of seeing so many anonymous AsyncCallback code blocks.

Thanks for your input


Does your MyAsyncCallback class contain any state?

If not, I can't think of anything that would prevent you from reusing it.

If it does... well, so far I've read that JavaScript is always single-threaded, so you should also be fine there.

0

精彩评论

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