Suppose I have a stateless session bean which is synchronized by the app server and I declare a StringBuilder as a class member(non-static). Is it also synchronized? Or do I have to synchonize myself?
Asked
Active
Viewed 91 times
0
-
2It is not synchronized. There's no magic there. However, if you happen to access it only through methods which are synchronized themselves, it may not matter. – Marko Topolnik Feb 03 '14 at 13:04
-
I would doubt your claim that an SLSB is synchronized by the container. The point of being stateless is that it *doesn't* need synchronization. – Marko Topolnik Feb 03 '14 at 13:06
-
`Variables` are not synchronised. Access to them via `functions/blocks` can be synchronized, as far as i know :) – Aman Arora Feb 03 '14 at 13:11
-
http://stackoverflow.com/questions/1935178/correct-usage-of-stateful-beans-with-servlets/1935476#1935476 post says that an SLSB is synchronized by the app server. – Krishna Chaitanya Feb 03 '14 at 13:12
-
2SLSB beans are not synchronized in terms of Java. Just the container doesn't allow two clients to use the same instance simultaneously. – Adrian Mitev Feb 04 '14 at 06:32