EJB Dont's

  • Do not read/write static fields
    • can use read-only stsic fields (declare as final).
    • Static fields are shared among all instances of a class. All instances may not be running in same JVM...a problem.
  • No use thread synchronization primitives to synchronize execution or multiple instances
    • If EJBs distributed in different JVMs will be a problem.
  • Not create or manage (start, stop, suspend, resume, change priority) threads
    • EJB container is responsible for creating and managing threads.
  • Not read/write files and directories or access file descriptors
    • these are local resources and not portable solution. Also could be security restriction.
  • Not listen or accept socket connections.
    • cant swap a EJB to disk if listening to a socket.