Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-1078

Allow a non-String object as a locking key in LockSupportCacheStore

    XMLWordPrintable

    Details

      Description

      LockSupportCacheStore uses String as its locking key. It is OK as long as the locking key can be represented as a String without much conversion cost. However, it the extending CacheStore implementation uses other type such as byte[] as its primary key type, it will result in unnecessary conversion from byte[] to String to achieve fine grained locking. I found a similar problem in BucketBasedCacheStore - it's converting an integer into a String unnecessarily.

      Therefore, I propose to generify LockSupportCacheStore:

      /**
       * @param L the type of the locking key
       */
      public abstract class LockSupportCacheStore<L> ... {
         ...
         protected abstract String getLockFromKey(L key) throws CacheLoaderException;
         ...
      }
      

      Then BucketBasedCacheStore and the new CacheStore implementation I'm writing for ISPN-701 will be more efficient.

      Mircea, could you confirm if my idea doesn't break anything? Because it's not a backward compatible change, I'd like to get this done before cutting the first candidate release.

        Attachments

          Activity

            People

            Assignee:
            trustin Trustin Lee (Inactive)
            Reporter:
            trustin Trustin Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: