Package java.lang.ref

Examples of java.lang.ref.Reference


  {
    CachedIntrospectionResults results = null;
    Object value = classCache.get(clazz);
    if (value instanceof Reference)
    {
      Reference ref = (Reference) value;
      results = (CachedIntrospectionResults) ref.get();
    }
    else
    {
      results = (CachedIntrospectionResults) value;
    }
View Full Code Here


    public Object get(Object key)
    {

        purge();

        Reference ref = (Reference) referenceMap.get(key);

        return (ref != null)
               ? ref.get()
               : null;
    }
View Full Code Here

        reportMeasurableCaches(isVerbose);
    }

    protected void defragCacheSet() {
        synchronized (cacheSet) {
            Reference unusedReference = null;
            while ((unusedReference = cacheQueue.poll()) != null) {
                cacheSet.remove(unusedReference.get());
            }
        }
    }
View Full Code Here

        }
    }

    protected void defragMeasurableCacheSet() {
        synchronized (measurableCacheSet) {
            Reference unusedReference = null;
            while ((unusedReference = measurableCacheQueue.poll()) != null) {
                measurableCacheSet.remove(unusedReference.get());
            }
        }
    }
View Full Code Here

  Method[] result = null;
  if (!ReflectUtil.isPackageAccessible(clz)) {
      return new Method[0];
  }
  final Class fclz = clz;
  Reference ref = (Reference)declaredMethodCache.get(fclz);
  if (ref != null) {
      result = (Method[])ref.get();
      if (result != null) {
    return result;
      }
  }
View Full Code Here

     * @param obj object that will be wrapped
     * @param soft true if a SoftReference should be created; otherwise Soft
     * @return a Reference or null if obj is null.
     */
    static Reference createReference(Object obj, boolean soft) {
  Reference ref = null;
  if (obj != null) {
      if (soft) {
    ref = new SoftReference(obj);
      } else {
    ref = new WeakReference(obj);
View Full Code Here

    private synchronized Class[] getParams() {
  Class[] clss = new Class[params.size()];

  for (int i = 0; i < params.size(); i++) {
      Reference ref = (Reference)params.get(i);
      Class cls = (Class)ref.get();
      if (cls == null) {
    return null;
      } else {
    clss[i] = cls;
      }
View Full Code Here

    /**
     * garbage collects all dereferenced objects in this cache
     */
    private synchronized void clean()
    {
        Reference ref;

        while ( (ref = this._refQueue.poll()) != null )
        {
            ByteBuffer buffer = (ByteBuffer) ref.get();
            _pool.remove( ref );

            if ( buffer != null )
            {
                LOG.log( Level.FINEST, "Collecting Buffer with capacity of " + buffer.capacity() );
View Full Code Here

        this.concurrent = ConcurrentMapFactory.isConcurrent(map);
    }
   
    public Object get(Object key) {
        processQueue();
        Reference ref = (Reference)map.get(key);
        return ref == null ? null : ref.get();
    }
View Full Code Here

      {
        o = null;
      }
      else
      {
        Reference ref = (Reference) val;
        if (ref.isEnqueued())
        {
          o = null;
        }
        else
        {
          o = (JRVirtualizable) ref.get();
        }
      }
      return o;
    }
View Full Code Here

TOP

Related Classes of java.lang.ref.Reference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.