Discussions

General J2EE: Accessing the 3rd party API using a stateless session bean

  1. I would like to know more about the consequences of stateless session bean accessing an ordinary java object. This java object is not an Entity Bean. I need to use this java object as a wrapper/helper to access the 3rd party API that I want to encapsulate within my app. Since, the 3rd party API uses local files for processing data, I need to provide a simple helper class to wrap this API as EJB specs doesn't allow accessing files directly.

    Session Facade-->OrdinaryJavaObject---->3rd Party API.

    I wanted to know if any one ever has implemented such solution and how are the issues such as scalability, performance, synchronization etc handled ?
    For e.g if there are 20 stateless session beans all trying to access this wrapper, how would the synchronization etc be handled ?
  2. Hi!

    The stateless session beans are fully synchronized according to the specification, and this gives you a nice environment to work in.

    When it comes to file access, introducing a wrapper class does not solve the spec. problem. That class is still executed in the context of the EJB container!!! However, it is possible to use files (and you need to do so when you depend on existing code), but you should be aware of the face that the file system is non-transactional.

    Tomas