11 Replies Latest reply on Apr 24, 2007 11:25 PM by David Rosenstrauch

    Node locking question

    David Rosenstrauch Newbie

      Hi. I'm kicking the tires on integrating JBossCache (2.0beta) into an app of mine. So far looks pretty good, but I've run into one small snag.

      I would like to find a way to atomically replace the contents of a node - i.e., perform:


      followed by


      all while the node is being locked.

      In other words, a method something like:


      if it existed.

      From what I can glean from the (somewhat minimal) details in the docs about locking, it looks like the putAll method operates under a lock, which is somewhat helpful. But the problem with using that is that if the old map contained mappings that don't exist in the new one, the old mappings will still remain in the node's data.

      So what I'm looking for is a way to replace the node's entire data. Any thread-safe way to do that?