T - The object type.public interface ReferenceCountedObject<T>
| Modifier and Type | Method and Description |
|---|---|
T |
get() |
boolean |
release()
Release the object.
|
T |
retain()
Retain the object for later use.
|
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, Runnable retainMethod, Runnable releaseMethod)
ReferenceCountedObject.Copyright © 2017–2022 The Apache Software Foundation. All rights reserved.