Package java.lang.ref

Examples of java.lang.ref.WeakReference


        inputContextLock = new Object();

        // Deserialized Windows are not yet visible.
        visible = false;

        weakThis = new WeakReference(this);

        anchor = new Object();
        sun.java2d.Disposer.addRecord(anchor, new WindowDisposerRecord(appContext, this));

        addToWindowList();
View Full Code Here


  Reference ref = null;
  if (obj != null) {
      if (soft) {
    ref = new SoftReference(obj);
      } else {
    ref = new WeakReference(obj);
      }
  }
  return ref;
    }
View Full Code Here

  }
  paramNames = new String[param.length];
  params = new ArrayList(param.length);
  for (int i = 0; i < param.length; i++) {
      paramNames[i] = param[i].getName();
      params.add(new WeakReference(param[i]));
  }
    }
View Full Code Here

    // of loading 2 classes in the same VM with the same name
    // and identityHashCode should be nearly impossible.
      }
      // Note: Use a weak reference to avoid holding on to extra
      // objects and classes after they should be unloaded.
      identitymap.put(identity, new WeakReference(k));
  }
View Full Code Here

        Document doc = node.getOwnerDocument();
        if (doc == null) {
            doc = (Document) node;
        }
        synchronized (doc) {
            WeakReference ref = (WeakReference) xpathSupportMap.get(doc);
            if (ref != null) {
                xps = (XPathSupport) ref.get();
            }
            if (xps == null) {
                try {
                    xps = (XPathSupport) xpathSupportClass.newInstance();
                    xpathSupportMap.put(doc, new WeakReference(xps));
                } catch (Exception e) {
                    logger.error("Error instantiating xpathSupport class", e);
                }               
            }
        }
View Full Code Here

            // 5a. Create a new entry for the field
            col = new LinkedList();
            knownFieldReferences.put( key, col );
          }
          // 6. Add a reference to cls to the entry
          col.add( new WeakReference( cls ) );
        }

        // The lines below will be used for the implementation of
        // Method call join points
        //
View Full Code Here

  /* (non-Javadoc)
   * @see java.util.Set#contains(java.lang.Object)
   */
  public boolean contains(Object o) {
    WeakReference wr = new WeakReference(o);
    return realSet.contains(wr);
  }
View Full Code Here

      private Iterator realIter = realSet.iterator();
      public boolean hasNext() {
        return realIter.hasNext();
      }
      public Object next() {
        WeakReference wr = (WeakReference) realIter.next();
        return wr.get();
      }
      public void remove() {
        throw new UnsupportedOperationException();
      }
    };
View Full Code Here

   * duplicate elements.
   *
   * @see java.util.Set#add
   */
  public boolean add(Object o) {
    WeakReference wr = new WeakReference(o);
    return realSet.add(wr);
  }
View Full Code Here

   *       is not supported by the underlying set.
   *
   * @see java.util.Set#remove(java.lang.Object)
   */
  public boolean remove(Object o) {
    WeakReference wr = new WeakReference(o);
    return realSet.remove(wr);
  }
View Full Code Here

TOP

Related Classes of java.lang.ref.WeakReference

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.