Iterator Pattern / Caching Design Problem


EJB design: Iterator Pattern / Caching Design Problem

  1. Iterator Pattern / Caching Design Problem (2 messages)

    I have a problem ... maybe I've got it all wrong ...

    I have multiple hashtable subclasses that contain POJOs + String key. Basically hashtable.put(DAO, key)

    I have stateless service that lookups hashtable sublclasses and sends back the reference over the pipe (this is bad)
    (Sub-Class-Hashtable)service.put("my.package.hashtable", hashtable);

    so far so good ... make server side service handle state ...keep hashtable of POJO-DAO current and synch with disk ...

    here is the question ... i don't want to have to send sub class hashtable accross the wire with every request ... and i don't want to keep a local copy ... do i have to pepper server side bean with finders ... how to i send the hashtable-across the wire ? should it be stateful session bean ...

    does anybody have any suggestions to improve performance?

    Threaded Messages (2)

  2. Serialized Transfer Objects[ Go to top ]

    General Rules:
    - The classes that are transferred from EJB to Web Layer needs to be serialized.

    Here are a couple of Strategies I have used in different situations for significant performance improvements:

    1) Convert the Domain Objects (that DAO's contain) to smaller Transfer objects(which contains a subset of the domain). This is useful when Presentation requires a much lower set of data for procesing. Note: The duplicate classes can create some code & maintenance overhead, so use if appropriate.

    2) As you mentioned, finders are definately required. A Session Facade can encapsulate the access to the DAO's

    3) Keep some of the objects in Session (again as needed). If the technical constrains allow this, this can be the best strategy.

    Hope this helps. Feel free to also email for any details(avianu at yahoo dot com)

    - Yogi
  3. Thanks[ Go to top ]

    Here is what I am going with so far...

    I have wrapped each "Value List" / "Iterator" inside an instance of a stateful session bean ... methods of stateful session bean corespond with those of "Value List" ... The Stateful session bean is responsible for object lifecycle ... ie when i want to reset cache .. i "remove" session bean ...

    Current I still trying to make value list lifecycle transparant to application ...

    i get list / list / iterator through local factoy
    private static List myList = null;

        list =

        unfortanuately i have to find way to synch remote lookup vs local lookup ..

    local it would be

    if (myList == null)
        // build new list