I agree with what you said. So should I take the 'synchronized' keyword off?
On Wed, Mar 9, 2011 at 7:39 PM, Matt Giuca <[email protected]> wrote: > > May be you are correct. I've used synchronized when working with threads >> and i *thought* synchronized also makes the statements wait for a call to >> return within that method. >> >> For example, if a query was made, I'd want it to wait till there's a >> feedback from the query without using a callback. >> > > Ah, no, that can't possibly be. In Java (and all other languages), calls to > a method *always* wait for a return statement before continuing (this is > called "synchronous calling"), so normally this is already the behaviour you > would expect. > > The reason in GWT we are getting calls to methods which *don't* wait for a > return (this is called "asynchronous calling") is that we are calling across > the client/server boundary, and the JavaScript which GWT is generating has > no idea *how* to wait for a return (this is sort of a failing of > JavaScript). This is why we are forced to use the Async classes with > callbacks. It's the only way to have code run when you finally receive a > response from the method (which is on the server side), and there is no way > to abstract over it. > > Therefore, if I am right about what "synchronized" actually does, I would > avoid using it for static methods unless you need thread-safe access to > static variables -- otherwise it will just slow down threaded code, and > possibly deadlock. > -- *Prageeth Silva*
-- Mailing list: https://launchpad.net/~mugle-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~mugle-dev More help : https://help.launchpad.net/ListHelp

