Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT - Reusing Callback Class

Tags:

gwt

My custom callback class implements AsyncCallback (like MyAsyncCallback 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

like image 941
moorsu Avatar asked Dec 02 '25 09:12

moorsu


1 Answers

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.

like image 92
Nicolas C Avatar answered Dec 07 '25 11:12

Nicolas C