0 Replies Latest reply on Apr 3, 2012 10:05 AM by rabiter

    ApplicationScoped thread-safety

    rabiter

      Hi friends,

       

      I've got a question: is the ApplicationScoped bean is thread safe? I mean, does the proxy controls all methods calls to the instance?

       

      @ApplicationScoped

      public class ApplicationScopedBean {

         

          public void doSomething() { // should I use the 'synchronized' keyword here?

              // change some critical state

          }

         

      }

       

      I've tested a little bit and it seems to be that just annotate the bean with the @ApplicationScoped annotation is not enought to get it thread-safe...

      Is it true? Seems like I have to control the thread-safety by my own means?

       

      Thanks!