T - The object type.public interface ReferenceCountedObject<T>
| 限定符和类型 | 方法和说明 |
|---|---|
T |
get() |
boolean |
release()
Release the object.
|
T |
retain()
Retain the object for later use.
|
static <V> ReferenceCountedObject<V> |
wrap(V value)
The same as wrap(value, EMPTY, EMPTY), where EMPTY is an empty method.
|
static <V> ReferenceCountedObject<V> |
wrap(V value,
Runnable retainMethod,
Runnable releaseMethod)
Wrap the given value as a
ReferenceCountedObject. |
T get()
T retain()
release() method must be invoked afterward.
Otherwise, the object is not returned, and it will cause a resource leak.boolean release()
static <V> ReferenceCountedObject<V> wrap(V value)
static <V> ReferenceCountedObject<V> wrap(V value, Runnable retainMethod, Runnable releaseMethod)
ReferenceCountedObject.Copyright © 2017–2023 The Apache Software Foundation. All rights reserved.