public final class ManagedReference<T>
extends io.netty.util.AbstractReferenceCounted
T) whose count is tracked via ReferenceCounted.
Created by ashwin.jayaprakash.
| Constructor and Description |
|---|
ManagedReference(T actualRef,
Predicate<T> retainVerifier,
Consumer<T> deallocator) |
| Modifier and Type | Method and Description |
|---|---|
T |
actualRef() |
protected void |
deallocate() |
static <TC extends AutoCloseable> |
newManagedReference(TC actualRef)
Convenience constructor for simple references that only need the
AutoCloseable.close() to be called. |
ManagedReference<T> |
retain() |
ManagedReference<T> |
retain(int increment) |
ManagedReference<T> |
touch() |
ManagedReference<T> |
touch(Object hint) |
public ManagedReference(T actualRef, Predicate<T> retainVerifier, Consumer<T> deallocator)
actualRef - retainVerifier - Called with "actualRef" as the parameter before returning from retain() or retain(int). If false is returned, then the "retain" method throws an
IllegalReferenceCountException.deallocator - Called automatically only when the AbstractReferenceCounted.refCnt() drops to 0 with "actualRef" as the
parameter.public static <TC extends AutoCloseable> ManagedReference<TC> newManagedReference(TC actualRef)
AutoCloseable.close() to be called.actualRef - public T actualRef()
public ManagedReference<T> retain()
retain in interface io.netty.util.ReferenceCountedretain in class io.netty.util.AbstractReferenceCountedpublic ManagedReference<T> retain(int increment)
retain in interface io.netty.util.ReferenceCountedretain in class io.netty.util.AbstractReferenceCountedpublic ManagedReference<T> touch()
touch in interface io.netty.util.ReferenceCountedtouch in class io.netty.util.AbstractReferenceCountedpublic ManagedReference<T> touch(Object hint)
protected void deallocate()
deallocate in class io.netty.util.AbstractReferenceCountedCopyright © 2018. All rights reserved.