2 Replies Latest reply on Oct 2, 2014 1:16 AM by Andreas Öh

    RemoteCache.replaceWithVersion return type

    Andreas Öh Newbie

      Hi,

      I'm using inifinispan hotrod client and replaceWithVersion to update my cache. According to the api documentation this method returns: "true if the value was replaced". When the value is not replaced, is there any way to get a reason for this? What kind of error preventing the cache to replace the value? 

      I'm especially interested in when an update fails due to incorrect version value. Is there any other method or implementation that I can use to get more information of what is the problem?


      I'm currently using version 6.0.1

       

      /Regards

      Andreas

        • 1. Re: RemoteCache.replaceWithVersion return type
          Radim Vansa Master

          It's not a "problem", it's a way to handle concurrent updates. You should retrieve the value & version using getWithVersion - the following replaceWithVersion should pass the version in order to make sure that nobody has changed the entry between those two operations. After the value is replaced, new version is generated in the cache - if you want to replace that again, you have to call getWithVersion again.

          • 2. Re: RemoteCache.replaceWithVersion return type
            Andreas Öh Newbie

            Hi Radim,

            Thanks for your response. I'm aware of the concept of replaceWithVersion and I'm using it exactly as you describe for handling concurrent updates of cache entries. What I am after is, if there exists other cases (except that the version does not match) where replaceWithVersion returns false?

            I know it throws a bunch of exceptions for various scenarios for instance for connection time out which is good, I just want to be sure that when it returns false it is because of concurrent update.

             

            Thanks.

            Andreas