Class FileInfoBackingCache.CachedFileInfo

    • Field Detail

      • ledgerId

        final long ledgerId
      • refCount

        final java.util.concurrent.atomic.AtomicInteger refCount
    • Constructor Detail

      • CachedFileInfo

        CachedFileInfo​(long ledgerId,
                       byte[] masterKey)
    • Method Detail

      • tryRetain

        boolean tryRetain()
        Attempt to retain the file info. When a client obtains a fileinfo from a container object, but that container object may release the fileinfo before the client has a chance to call retain. In this case, the file info could be released and the destroyed before we ever get a chance to use it.

        tryRetain avoids this problem, by doing a compare-and-swap on the reference count. If the refCount is negative, it means that the fileinfo is being cleaned up, and this fileinfo object should not be used. This works in tandem with #markDead, which will only set the refCount to negative if noone currently has it retained (i.e. the refCount is 0).

        true if we managed to increment the refcount, false otherwise
      • getRefCount

        int getRefCount()
      • release

        void release()
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object