Package gw.util.cache

Class WeakFqnCache<T>

  • All Implemented Interfaces:
    IFqnCache<T>

    public class WeakFqnCache<T>
    extends java.lang.Object
    implements IFqnCache<T>
    • Field Detail

      • _cache

        private FqnCache<java.lang.ref.WeakReference<T>> _cache
      • _queue

        private java.lang.ref.ReferenceQueue<T> _queue
    • Constructor Detail

      • WeakFqnCache

        public WeakFqnCache()
    • Method Detail

      • add

        public void add​(java.lang.String fqn)
        Specified by:
        add in interface IFqnCache<T>
      • add

        public void add​(java.lang.String fqn,
                        T userData)
        Specified by:
        add in interface IFqnCache<T>
      • remove

        public boolean remove​(java.lang.String fqn)
        Specified by:
        remove in interface IFqnCache<T>
      • _remove

        private boolean _remove​(java.lang.String fqn)
      • get

        public T get​(java.lang.String fqn)
        Specified by:
        get in interface IFqnCache<T>
      • contains

        public boolean contains​(java.lang.String fqn)
        Specified by:
        contains in interface IFqnCache<T>
      • remove

        public void remove​(java.lang.String[] fqns)
        Specified by:
        remove in interface IFqnCache<T>
      • clear

        public void clear()
        Specified by:
        clear in interface IFqnCache<T>
      • getFqns

        public java.util.Set<java.lang.String> getFqns()
        Specified by:
        getFqns in interface IFqnCache<T>
      • visitDepthFirst

        public void visitDepthFirst​(Predicate<T> visitor)
        Specified by:
        visitDepthFirst in interface IFqnCache<T>
        Parameters:
        visitor - returns whether or not to terminate visiting
      • visitBreadthFirst

        public void visitBreadthFirst​(Predicate<T> visitor)
        Specified by:
        visitBreadthFirst in interface IFqnCache<T>
        Parameters:
        visitor - returns whether or not to continue visiting children of T
      • removeReleasedEntries

        private void removeReleasedEntries()