This forum has been archived. Please start a new discussion on GitHub.

Java version of C++ IceUtil::Cache

In the Connections issue #25 page 8, there's discussion of the C++ IceUtil::Cache class which is provided to work around the mutex in the C++ EvictorBase which allows only one servant locator to be running at a time.

The comment is made that it's only available for C++. What's the reasoning for this?

Our servant evictor is in Java, and in 1.5 or greater, one could in replace the java.util.Map with a java.util.concurrent.ConcurrentHashMap, but at a quick glance, this wouldn't solve all the issues of using Zeroc's LinkedList class.



  • bernard
    bernard Jupiter, FL
    Hi Blair,

    That's a bug in the article ... there is actually a corresponding pair of classes in Java, IceUtil.Cache and IceUtil.Store.

    Like IceUtil::Cache in C++, these classes are used in Java to implement the Freeze Evictor.

    As mentioned in the article, the main use of these classes is to allow concurrent lookups/loads from the database within a single servant locator + evictor.
    If you have two servant locators, each with its own associated EvictorBase evictor, there is no synchronization between these evictors, and requests could be processed in parallel by the two servant locators/evictors.

    Best regards,