GWT - Reusing Callback Class
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.
精彩评论