Examples of WeakReference


Examples of java.lang.ref.WeakReference

      try {
        try {
          timers_mon.enter();
          // crappy
          for (Iterator iter = timers.iterator(); iter.hasNext();) {
            WeakReference timerRef = (WeakReference) iter.next();
            Timer timer = (Timer) timerRef.get();
            if (timer == null) {
              iter.remove();
            } else {
              count++;
             
View Full Code Here

Examples of java.lang.ref.WeakReference

   * Dynamically update the look and feel of all widgets
   */
  public static void updateAllWidgets() {
    synchronized (widgets) {
      for (int i=0; i<widgets.size(); i++) {
        WeakReference ref = (WeakReference) widgets.get(i);
        Widget referent = (Widget) ref.get();
       
        if (referent != null) {
          Component component = referent.getWidget();
          if (component != null)
            SwingUtilities.updateComponentTreeUI(component);
View Full Code Here

Examples of java.lang.ref.WeakReference

   * Internally used by Frame/Dialogs to register themselves
   * when they are created. Needed for dynamic Look And Feel
   * changes
   */
  public static void register(Widget widget) {
    WeakReference reference = new WeakReference(widget);
    reference.enqueue();
    synchronized (widgets) {
      widgets.add(reference);
    }
    System.gc();
  }
View Full Code Here

Examples of java.lang.ref.WeakReference

   * changes
   */
  public static void unregister(Widget widget) {
    synchronized (widgets) {
      for (Iterator i = widgets.iterator(); i.hasNext(); ) {
        WeakReference ref = (WeakReference) i.next();
        Object referent = ref.get();
       
        if (referent == widget || referent == null) {
          i.remove();
        }
      }
View Full Code Here

Examples of java.lang.ref.WeakReference

       
        ByteBuffer[] raw_buffers   = (ByteBuffer[])rawBufferCache.get();
        if(raw_buffers == null)
        {
          raw_buffers = new ByteBuffer[buffer_limit];
          rawBufferCache = new WeakReference(raw_buffers);
        } else
        {
          Arrays.fill(raw_buffers, null);
        }
         
       
        int[] orig_positions  = (int[])origPositionsCache.get();
        if(orig_positions == null)
        {
          orig_positions = new int[buffer_limit];
          origPositionsCache = new WeakReference(orig_positions);
        } else
        {
          Arrays.fill(orig_positions, 0);
        }
         
View Full Code Here

Examples of java.lang.ref.WeakReference

   * @param i
   */
  public CopyOnWriteList(int initialCapacity) {
    this.initialCapacity = initialCapacity;
    if (stats != null) {
      stats.add(new WeakReference(this));
    }
  }
View Full Code Here

Examples of java.lang.ref.WeakReference

  public CopyOnWriteList() {
    // Smaller default initial capacity as most of our lists are small
    // Last check on 7/24/2008: 444 lists with 456 total entries
    this.initialCapacity = 1;
    if (stats != null) {
      stats.add(new WeakReference(this));
    }
  }
View Full Code Here

Examples of java.lang.ref.WeakReference

    }
    if (listeners == null)
    {
      listeners = new ArrayList(5);
    }
    listeners.add(new WeakReference(l));
  }
View Full Code Here

Examples of java.lang.ref.WeakReference

    }
    ArrayList removeList = null;

    for (int i = 0; i < listeners.size(); i++)
    {
      final WeakReference ref = (WeakReference) listeners.get(i);
      final StyleChangeListener l = (StyleChangeListener) ref.get();
      if (l != null)
      {
        l.styleChanged(source, key, value);
      }
      else
View Full Code Here

Examples of java.lang.ref.WeakReference

    }
    ArrayList removeList = null;

    for (int i = 0; i < listeners.size(); i++)
    {
      final WeakReference ref = (WeakReference) listeners.get(i);
      final StyleChangeListener l = (StyleChangeListener) ref.get();
      if (l != null)
      {
        l.styleRemoved(source, key);
      }
      else
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.