Re: instance or class?
If I run it from a single browser (as I do during development) it runs fine. It becomes flaky when I try to use it from different browsers and/or different machines at the same time. I know about tomcat reusing the same backend instances so I am sensitive about that. (I don't know if GlassFish does that too.) The backend code for the flaky part has no instance variables so reuse should not be a problem.Due to the responses on this mailing list and my tests, I now think the problem is on the backend. One instance runs fine. If I introduce a second instance, the second instance runs fine but then the first instance messes up randomly. I'll keep looking.
Sounds like a typical thread safety issue. As you said you dont have instance variables, do you have non final static class variables? If so, your code probably does not do what you think it should do. Lets assume you have static int intVariable = 0; somewhere and Thread A sets value to 5 and later on expects to read a value of 5. Between write and read a second Thread B could modify the value. This can even happen between two lines of code.
Depending on the concrete code you want to use synchronized blocks, ThreadLocal variables, classes from http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/atomic/package-summary.html
In case of ThreadLocal variables, make sure to clean them up once the request is done. Otherwise you probably run into a ThreadLocal memory leaks and PermGen space issues on redeployment.
-- J.
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home