Package java.lang.ref

Examples of java.lang.ref.WeakReference


    }
    // add eventually missing attribute impls to the existing sink
    for (Iterator it = this.cloneAttributes().getAttributeImplsIterator(); it.hasNext(); ) {
      sink.addAttributeImpl((AttributeImpl) it.next());
    }
    this.sinks.add(new WeakReference(sink));
  }
View Full Code Here


        this.server.setHttpService(new EchoService());

        MultiThreadedHttpConnectionManager mthcm = new MultiThreadedHttpConnectionManager();
        client.setHttpConnectionManager(mthcm);
        WeakReference wr = new WeakReference(mthcm);

        GetMethod method = new GetMethod("/");
        client.executeMethod(method);
        method.releaseConnection();

        mthcm = null;
        client = null;
        method = null;
       
        System.gc();

        // this sleep appears to be necessary in order to give the JVM
        // time to clean up the miscellaneous pointers to the connection manager
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            fail("shouldn't be interrupted.");
        }

        Object connectionManager = wr.get();
        assertNull("connectionManager should be null", connectionManager);
    }   
View Full Code Here

            public void actionPerformed(ActionEvent e) {
                boolean visible = gestureMI.isSelected();
                if (gestureHUDRef == null || gestureHUDRef.get() == null) {
                    GestureHUD hud = new GestureHUD(gestureMI);
                    hud.setAvatarCharacter(avatarCellRenderer.getAvatarCharacter(), visible);
                    gestureHUDRef = new WeakReference(hud);
                }
                //issue #174 hud visibility management
                if (visible) {
                  gestureHUDRef.get().setMaximized();
                }
View Full Code Here

    private ViewPropertiesJDialog getViewPropertiesJDialog() {
        if (viewPropertiesFrameRef == null ||
                viewPropertiesFrameRef.get() == null) {
            ViewPropertiesJDialog viewPropertiesFrame =
                    new ViewPropertiesJDialog();
            viewPropertiesFrameRef = new WeakReference(viewPropertiesFrame);
            return viewPropertiesFrame;
        } else {
            return viewPropertiesFrameRef.get();
        }
    }
View Full Code Here

    /* The time the file was last modified when it was last read */
    private long lastModifiedWhenRead = -1;
   
    /** Default constructor, should never be called */
    protected WFSCell(WFS wfs, String cellName, WFSCellDirectory parentDirectory, CellDelegate delegate) {
        this.wfsRef = new WeakReference(wfs);
        this.parentDirectory = parentDirectory;
        this.delegate = delegate;
        this.cellName = cellName;
       
        /*
 
View Full Code Here

   
    /**
     * Constructor, takes the implementation-specific directory delegate
     */
    public WFSCellDirectory(WFS wfs, WFSCell assocCell, DirectoryDelegate del) {
        this.wfsRef = new WeakReference(wfs);
        this.associatedCell = assocCell;
        this.delegate = del;
   
        /* Compute what the path name of this directory should be */
        try {
View Full Code Here

    /**
     * Constructor, which takes no parent directory (if this is the root
     * directory
     */
    public WFSCellDirectory(WFS wfs, DirectoryDelegate delegate) {
        this.wfsRef = new WeakReference(wfs);
        this.associatedCell = null;
        this.delegate = delegate;
        this.pathName = "";
    }
View Full Code Here

     * not added multiple times; they will be cleaned too often.
     */

    public void add(ICleanable cleanable)
    {
        WeakReference reference = new WeakReference(cleanable);

        synchronized (references)
        {
            references.add(reference);
        }
View Full Code Here

        {
            Iterator i = references.iterator();

            while (i.hasNext())
            {
                WeakReference ref = (WeakReference) i.next();

                ICleanable cleanable = (ICleanable) ref.get();

                if (cleanable == null)
                    i.remove();
                else
                    cleanable.executeCleanup();
View Full Code Here

        synchronized (m_arrListeners) {
            List arrEmptyReferences = null;
       
        for (Iterator it = m_arrListeners.iterator(); it.hasNext();)
        {
                WeakReference objRef = (WeakReference) it.next();
          ITableDataModelListener objListener =
            (ITableDataModelListener) objRef.get();
                if (objListener != null)
                    objListener.tableDataChanged(objEvent);
                else {
                    if (arrEmptyReferences == null)
                        arrEmptyReferences = new ArrayList();
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.