6 Replies Latest reply on Feb 23, 2005 2:10 PM by Kris Jenkins

    Atomic read OR write

    Kris Jenkins Newbie


      I'm looking into migrating from OSCache to JBossCache, and I'm worried about a locking issue.

      I'd like to be able to say, atomically, "Read this FQN/KEY, and if it comes back null, acquire a write lock and query the database". What I want to avoid is having two threads which read, find the key empty, first thread aquires a write lock, second thread queues for a write lock when it will only need a read lock.

      Is it possible to do this with JBossCache?