3 Replies Latest reply on Sep 21, 2001 7:25 PM by juha

    use of synchronized methods

    jseaman

      Hello,

      Is there a problem in using synchronized methods in a helper class that is used by a stateless session bean.
      I've heard using synchronized methods in beans themselves is incorrect but I was wondering about using them in helper classes.

      Thanks,

      Jeff Seaman

        • 1. Re: use of synchronized methods
          hstech

          Hi Jeff,

          You shouldn't have any problems with synchronized methods in helper classes, but it seems to be a very strange request. Each EJB instance will be single threaded, so there should be no need to synchronize at your helper class methods.

          What are you trying to do?

          Cheers,
          Aaron.

          • 2. Re: use of synchronized methods
            jseaman

            Thanks Aaron,

            What I was trying to do is make the helper a singleton to be shared by stateless session beans. Where the helper would have a cache and manage shadow objects from my database. I think this is all a no no and a kludge - probably what I should do is just use entity beans from a session bean facade.

            Any ideas or comments?

            Thanks,

            Jeff

            • 3. Re: use of synchronized methods

              There's alot of information available on singletons in J2EE, check the resources on theserverside.com for example.