Discussions

EJB design: Synchronization in Stateless EJBs

  1. Synchronization in Stateless EJBs (4 messages)

    How do i synchronize read/write access to a class variable in a stateless session bean!
    I dont want to use a stateful session bean.

    Threaded Messages (4)

  2. How do i synchronize read/write access to a class variable in a stateless session bean!


    You should not write to static variables in an EJB. This has been a restriction in the spec for a long time. Here it is from the latest EJB spec (25.1.2 Programming Restrictions in EJB 2.1 PFD):

    An enterprise Bean must not use read/write static fields. Using read-only static fields is allowed. Therefore, it is recommended that all static fields in the enterprise bean class be declared as final.
  3. How do i implement Thread/Resource pooling logic using stateless beans!!
  4. Synchronization in Stateless EJBs[ Go to top ]

    Hi,
    As per EJB, Programmers should not worry about all the middler tier services and should concentrate on the business logic. Hence there are so many products in the market which provides the services.

    Cheers
    Rafi
  5. not recommended[ Go to top ]

    Ejb Specification dose not recommend to use sychronization,createtion of threads stuff,as application server takes care of this issues.

    :)Anil