Coverage Summary for Class: FinalizableSoftReference (com.google.common.base)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| FinalizableSoftReference | 0% (0/1) | 0% (0/1) | 0% (0/2) |
1 /* 2 * Copyright (C) 2007 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 * in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the License 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 * or implied. See the License for the specific language governing permissions and limitations under 12 * the License. 13 */ 14 15 package com.google.common.base; 16 17 import com.google.common.annotations.GwtIncompatible; 18 import java.lang.ref.ReferenceQueue; 19 import java.lang.ref.SoftReference; 20 import javax.annotation.CheckForNull; 21 22 /** 23 * Soft reference with a {@code finalizeReferent()} method which a background thread invokes after 24 * the garbage collector reclaims the referent. This is a simpler alternative to using a {@link 25 * ReferenceQueue}. 26 * 27 * @author Bob Lee 28 * @since 2.0 29 */ 30 @GwtIncompatible 31 @ElementTypesAreNonnullByDefault 32 public abstract class FinalizableSoftReference<T> extends SoftReference<T> 33 implements FinalizableReference { 34 /** 35 * Constructs a new finalizable soft reference. 36 * 37 * @param referent to softly reference 38 * @param queue that should finalize the referent 39 */ 40 protected FinalizableSoftReference(@CheckForNull T referent, FinalizableReferenceQueue queue) { 41 super(referent, queue.queue); 42 queue.cleanUp(); 43 } 44 }