Top Description Inners Fields Constructors Methods
io.netty5.buffer.internal

public final Class CleanerDrop<T extends Buffer>

extends Object
implements Drop<T extends Buffer>
Class Inheritance
All Implemented Interfaces
io.netty5.buffer.Drop
Imports
io.netty5.buffer.AllocatorControl, .Buffer, .BufferAllocator, .Drop, .MemoryManager, java.lang.ref.Cleaner, java.util.concurrent.atomic.AtomicReference

A drop implementation that delegates to another drop instance, either when called directly, or when it becomes cleanable. This ensures that objects are dropped even if they leak.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private Cleaner.Cleanable
private CleanerDrop.GatedRunner<T>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
attach(T
The new Resource instance with the new owner.
obj
)

Implements io.netty5.buffer.Drop.attach.

Called when the resource changes owner.
public void
drop(T
The Resource instance being dropped.
obj
)

Implements io.netty5.buffer.Drop.drop.

Dispose of the resources in the given Resource instance.
public Drop<T>
fork()

Implements io.netty5.buffer.Drop.fork.

Branch the responsibility of dropping a resource.
private static <T extends Buffer> CleanerDrop<T>
innerWrap(Drop<T> drop, MemoryManager manager, boolean detectLeaks)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public static <T extends Buffer> Drop<T>
wrap(Drop<T> drop, MemoryManager manager)

Wrap the given drop instance, and produce a new drop instance that will also call the delegate drop instance if it becomes cleanable.

public static <T extends Buffer> Drop<T>
wrapWithoutLeakDetection(Drop<T> drop, MemoryManager manager)

Wrap the given drop instance, and produce a new drop instance that will also call the delegate drop instance if it becomes cleanable.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cleanableback to summary
private Cleaner.Cleanable cleanable
runnerback to summary
private CleanerDrop.GatedRunner<T> runner

Constructor Detail

CleanerDropback to summary
private CleanerDrop()

Method Detail

attachback to summary
public void attach(T obj)

Implements io.netty5.buffer.Drop.attach.

Doc from io.netty5.buffer.Drop.attach.

Called when the resource changes owner.

Parameters
obj:T

The new Resource instance with the new owner.

Annotations
@Override
dropback to summary
public void drop(T obj)

Implements io.netty5.buffer.Drop.drop.

Doc from io.netty5.buffer.Drop.drop.

Dispose of the resources in the given Resource instance.

Parameters
obj:T

The Resource instance being dropped.

Annotations
@Override
forkback to summary
public Drop<T> fork()

Implements io.netty5.buffer.Drop.fork.

Doc from io.netty5.buffer.Drop.fork.

Branch the responsibility of dropping a resource. This drop instance will remain associated with its current resource, while the returned drop instance must be attached to its new resource.

Returns:Drop<T>

A drop instance, similar to this one, but for the purpose of being associated with a different but related resource.

Annotations
@Override
innerWrapback to summary
private static <T extends Buffer> CleanerDrop<T> innerWrap(Drop<T> drop, MemoryManager manager, boolean detectLeaks)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
wrapback to summary
public static <T extends Buffer> Drop<T> wrap(Drop<T> drop, MemoryManager manager)

Wrap the given drop instance, and produce a new drop instance that will also call the delegate drop instance if it becomes cleanable.

wrapWithoutLeakDetectionback to summary
public static <T extends Buffer> Drop<T> wrapWithoutLeakDetection(Drop<T> drop, MemoryManager manager)

Wrap the given drop instance, and produce a new drop instance that will also call the delegate drop instance if it becomes cleanable.

The produced drop will not report to the LeakDetection, but forks of the drop will. This is used by the const-buffer suppliers, which don't expose any way for them to be closed.

io.netty5.buffer.internal back to summary

private final Class CleanerDrop.GatedRunner<T extends Buffer>

extends AtomicReference<Object>
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
private static final CleanerDrop.NoOpAllocatorControl
pack-priv final boolean
pack-priv final Drop<T>
pack-priv volatile boolean
pack-priv final MemoryManager
private static final long
pack-priv LifecycleTracer
pack-priv volatile boolean

Constructor Summary

AccessConstructor and Description
private
GatedRunner(Drop<T> drop, MemoryManager manager, boolean detectLeaks)

Method Summary

Modifier and TypeMethod and Description
public void
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from java.util.concurrent.atomic.AtomicReference:
accumulateAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndAccumulategetAndSetgetAndUpdategetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleasetoStringupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

ALLOC_CONTROLback to summary
private static final CleanerDrop.NoOpAllocatorControl ALLOC_CONTROL
detectLeaksback to summary
pack-priv final boolean detectLeaks
dropback to summary
pack-priv final Drop<T> drop
droppingback to summary
pack-priv volatile boolean dropping
managerback to summary
pack-priv final MemoryManager manager
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicReference.serialVersionUID.

tracerback to summary
pack-priv LifecycleTracer tracer
tracerFromSplitParentback to summary
pack-priv volatile boolean tracerFromSplitParent

Constructor Detail

GatedRunnerback to summary
private GatedRunner(Drop<T> drop, MemoryManager manager, boolean detectLeaks)

Method Detail

prepareRecoverback to summary
public void prepareRecover(T obj)
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@SuppressWarnings:unchecked
@Override
io.netty5.buffer.internal back to summary

private final Class CleanerDrop.NoOpAllocatorControl

extends Object
implements AllocatorControl
Class Inheritance
All Implemented Interfaces
io.netty5.buffer.AllocatorControl

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public BufferAllocator
getAllocator()

Implements io.netty5.buffer.AllocatorControl.getAllocator.

Get the BufferAllocator instance that is the source of this allocator control.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NoOpAllocatorControlback to summary
private NoOpAllocatorControl()

Method Detail

getAllocatorback to summary
public BufferAllocator getAllocator()

Implements io.netty5.buffer.AllocatorControl.getAllocator.

Doc from io.netty5.buffer.AllocatorControl.getAllocator.

Get the BufferAllocator instance that is the source of this allocator control.

Returns:BufferAllocator

The BufferAllocator controlled by this AllocatorControl.

Annotations
@Override