Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 35 for WeakReference (0.14 sec)

  1. guava-testlib/test/com/google/common/testing/GcFinalizationTest.java

        GcFinalization.awaitDone(future);
        assertTrue(future.isDone());
        assertTrue(future.isCancelled());
      }
    
      public void testAwaitClear() {
        final WeakReference<Object> ref = new WeakReference<>(new Object());
        GcFinalization.awaitClear(ref);
        assertNull(ref.get());
      }
    
      public void testAwaitDone_finalizationPredicate() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  2. android/guava-testlib/test/com/google/common/testing/GcFinalizationTest.java

        GcFinalization.awaitDone(future);
        assertTrue(future.isDone());
        assertTrue(future.isCancelled());
      }
    
      public void testAwaitClear() {
        final WeakReference<Object> ref = new WeakReference<>(new Object());
        GcFinalization.awaitClear(ref);
        assertNull(ref.get());
      }
    
      public void testAwaitDone_finalizationPredicate() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  3. android/guava-testlib/src/com/google/common/testing/GcFinalization.java

     * leaks, by ensuring that objects are no longer strongly referenced:
     *
     * <pre>{@code
     * // Helper function keeps victim stack-unreachable.
     * private WeakReference<Foo> fooWeakRef() {
     *   Foo x = ....;
     *   WeakReference<Foo> weakRef = new WeakReference<>(x);
     *   // ... use x ...
     *   x = null;  // Hint to the JIT that x is stack-unreachable
     *   return weakRef;
     * }
     * public void testFooLeak() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/collect/InternersTest.java

        Integer canonical = new Integer(5);
        Integer not = new Integer(5);
    
        Interner<Integer> pool = Interners.newWeakInterner();
        assertSame(canonical, pool.intern(canonical));
    
        WeakReference<Integer> signal = new WeakReference<>(canonical);
        canonical = null; // Hint to the JIT that canonical is unreachable
    
        GcFinalization.awaitClear(signal);
        assertSame(not, pool.intern(not));
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Jul 24 22:09:38 UTC 2024
    - 4K bytes
    - Viewed (0)
  5. guava/src/com/google/common/util/concurrent/FuturesGetChecked.java

           * UnsignedBytesBenchmark. TODO(cpovirk): benchmark this
           */
          /*
           * A CopyOnWriteArraySet<WeakReference> is faster than a newSetFromMap of a MapMaker map with
           * weakKeys() and concurrencyLevel(1), even up to at least 12 cached exception types.
           */
          private static final Set<WeakReference<Class<? extends Exception>>> validClasses =
              new CopyOnWriteArraySet<>();
    
          @Override
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Feb 22 17:40:56 UTC 2024
    - 11.9K bytes
    - Viewed (0)
  6. guava/src/com/google/common/base/Platform.java

        WeakReference<? extends Enum<?>> ref = Enums.getEnumConstants(enumClass).get(value);
        /*
         * We use `fromNullable` instead of `of` because `WeakReference.get()` has a nullable return
         * type.
         *
         * In practice, we are very unlikely to see `null`: The `WeakReference` to the enum constant
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Apr 15 22:32:14 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  7. guava-tests/test/com/google/common/base/FinalizableReferenceQueueTest.java

    import com.google.common.annotations.GwtIncompatible;
    import com.google.common.base.internal.Finalizer;
    import com.google.common.testing.GcFinalization;
    import java.lang.ref.ReferenceQueue;
    import java.lang.ref.WeakReference;
    import java.net.URL;
    import java.net.URLClassLoader;
    import java.util.Arrays;
    import java.util.Collections;
    import junit.framework.TestCase;
    import org.checkerframework.checker.nullness.qual.Nullable;
    
    /**
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Oct 21 14:28:19 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  8. guava-testlib/src/com/google/common/testing/GcFinalization.java

     * leaks, by ensuring that objects are no longer strongly referenced:
     *
     * <pre>{@code
     * // Helper function keeps victim stack-unreachable.
     * private WeakReference<Foo> fooWeakRef() {
     *   Foo x = ....;
     *   WeakReference<Foo> weakRef = new WeakReference<>(x);
     *   // ... use x ...
     *   x = null;  // Hint to the JIT that x is stack-unreachable
     *   return weakRef;
     * }
     * public void testFooLeak() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  9. guava-tests/test/com/google/common/base/FinalizableReferenceQueueClassLoaderUnloadingTest.java

        AtomicReference<Object> sepStopwatchA =
            new AtomicReference<Object>(sepStopwatchC.getMethod("createUnstarted").invoke(null));
        AtomicReference<WeakReference<?>> sepStopwatchRef =
            new AtomicReference<WeakReference<?>>(
                (WeakReference<?>) sepFwrCons.newInstance(sepStopwatchA.get(), sepFrqA.get()));
        assertNotNull(sepStopwatchA.get());
        // Clear all references to the Stopwatch and wait for it to be gc'd.
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  10. android/guava-tests/test/com/google/common/util/concurrent/StripedTest.java

      public void testStrongImplementations() {
        for (Striped<?> striped : strongImplementations()) {
          WeakReference<Object> weakRef = new WeakReference<>(striped.get(new Object()));
          WeakReference<Object> garbage = new WeakReference<>(new Object());
          GcFinalization.awaitClear(garbage);
          assertNotNull(weakRef.get());
        }
      }
    
      public void testMaximalWeakStripedLock() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Jun 26 12:58:35 UTC 2024
    - 8.4K bytes
    - Viewed (0)
Back to top