Package java.lang.ref

Examples of java.lang.ref.WeakReference.clear()


                // garbage-collected; let's take the opportunity to
                // clean up the cursors list anyway..
                it.remove();

            } else if (cursor == cur) {
                ref.clear();
                it.remove();
                break;
            }
        }
    }
View Full Code Here


            WeakReference ref = (WeakReference) it.next();
            Cursor cursor = (Cursor) ref.get();
            if (cursor != null) {
                // cursor is null if object has been garbage-collected
                cursor.invalidate();
                ref.clear();
            }
            it.remove();
        }
    }
View Full Code Here

                // garbage-collected; let's take the opportunity to
                // clean up the cursors list anyway..
                it.remove();

            } else if (cursor == cur) {
                ref.clear();
                it.remove();
                break;
            }
        }
    }
View Full Code Here

            WeakReference ref = (WeakReference) it.next();
            Cursor cursor = (Cursor) ref.get();
            if (cursor != null) {
                // cursor is null if object has been garbage-collected
                cursor.invalidate();
                ref.clear();
            }
            it.remove();
        }
    }
View Full Code Here

    SoftReference sr = new SoftReference(tmpA, new ReferenceQueue());
    WeakReference wr = new WeakReference(tmpB, new ReferenceQueue());
    assertTrue("Start: Object not cleared.", (sr.get() != null)
        && (wr.get() != null));
    sr.clear();
    wr.clear();
    assertTrue("End: Object cleared.", (sr.get() == null)
        && (wr.get() == null));
    // Must reference tmpA and tmpB so the jit does not optimize them away
    assertTrue("should always pass", tmpA != sr.get() && tmpB != wr.get());
  }
View Full Code Here

                // garbage-collected; let's take the opportunity to
                // clean up the cursors list anyway..
                it.remove();
               
            } else if (cursor == cur) {
                ref.clear();
                it.remove();
                break;
            }
        }
    }
View Full Code Here

            WeakReference ref = (WeakReference) it.next();
            Cursor cursor = (Cursor) ref.get();
            if (cursor != null) {
                // cursor is null if object has been garbage-collected
                cursor.invalidate();
                ref.clear();
            }
            it.remove();
        }
    }
View Full Code Here

                // garbage-collected; let's take the opportunity to
                // clean up the cursors list anyway..
                it.remove();

            } else if (cur == cursor) {
                ref.clear();
                it.remove();
                break;
            }
        }
    }
View Full Code Here

                // garbage-collected; let's take the opportunity to
                // clean up the cursors list anyway..
                it.remove();

            } else if (cur == cursor) {
                ref.clear();
                it.remove();
                break;
            }
        }
    }
View Full Code Here

                // garbage-collected; let's take the opportunity to
                // clean up the cursors list anyway..
                it.remove();
               
            } else if (cursor == cur) {
                ref.clear();
                it.remove();
                break;
            }
        }
    }
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.