Results 1 to 3 of 3

Thread: Need suggestions

  1. #1

    Default Need suggestions

    So here is my situation: I have a web-app with several controllers. Each controller is injected with a singleton bean which is used as the API to backend functionality. This bean will be injected with several singleton DAO beans to perform various queries and return data objects. As it stands now, each DAO has a unique class variable object and this object will contain only SQL statements. Data is passed down from the request->controllers->interfacing bean->DAO->SQL object. The query string is constructed/completed with the parameters and returned to the DAO to perform the query and construct the data object. Since the SQL class of the DAO is a class variable, it is not thread-safe. I need some help making it thread-safe. Should I synchronize the SQL methods that construct and return the SQL statements? Perhaps this is the worst option since it could possibly degrade performance. What are some better techniques for the above scenario?

    Thanks

  2. #2

    Default

    Well, I removed all class-wide state from the SQL class... which should make it thread-safe. Guess thats the best solution.

  3. #3
    Join Date
    Apr 2009
    Posts
    1

    Default

    All classes derived from a base class should be interchangeable

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •