Top Fields Constructors Methods
io.netty5.util.internal

public Class SendFromSupplier<T extends io.netty5.util.Resource<T>>

extends Object
implements Send<T extends Resource<T>>
Class Inheritance
All Implemented Interfaces
io.netty5.util.Send, io.netty5.util.SafeCloseable, java.lang.AutoCloseable
Imports
io.netty5.util.Resource, .Send, java.lang.invoke.VarHandle, java.util.Objects, java.util.function.Supplier

Field Summary

Modifier and TypeField and Description
private final Class<T>
private static final VarHandle
private volatile boolean
private final Supplier<? extends T>

Constructor Summary

AccessConstructor and Description
public
SendFromSupplier(Class<T> concreteObjectType, Supplier<? extends T> supplier)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements io.netty5.util.Send.close.

Discard this Send and the object it contains.
private boolean

Returns:

true if the gate has already been passed, otherwise false if we got through the gate first.
passGate
()

Atomically check and pass through the gate.

public T
receive()

Implements io.netty5.util.Send.receive.

Receive the Resource instance being sent, and bind its ownership to the calling thread.
public boolean
referentIsInstanceOf(Class<?>
The type to check.
cls
)

Implements io.netty5.util.Send.referentIsInstanceOf.

Determine if the object received from this Send is an instance of the given class.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

concreteObjectTypeback to summary
private final Class<T> concreteObjectType
GATEback to summary
private static final VarHandle GATE
gateback to summary
private volatile boolean gate
Annotations
@SuppressWarnings:unused
supplierback to summary
private final Supplier<? extends T> supplier

Constructor Detail

SendFromSupplierback to summary
public SendFromSupplier(Class<T> concreteObjectType, Supplier<? extends T> supplier)

Method Detail

closeback to summary
public void close()

Implements io.netty5.util.Send.close.

Doc from io.netty5.util.Send.close.

Discard this Send and the object it contains. This has no effect if the send-object has already been received.

Annotations
@Override
passGateback to summary
private boolean passGate()

Atomically check and pass through the gate.

Returns:boolean

true if the gate has already been passed, otherwise false if we got through the gate first.

receiveback to summary
public T receive()

Implements io.netty5.util.Send.receive.

Doc from io.netty5.util.Send.receive.

Receive the Resource instance being sent, and bind its ownership to the calling thread. The invalidation of the sent resource in the sending thread happens-before the return of this method.

This method can only be called once, and will throw otherwise.

Returns:T

The sent resource instance, never null.

Annotations
@Override
referentIsInstanceOfback to summary
public boolean referentIsInstanceOf(Class<?> cls)

Implements io.netty5.util.Send.referentIsInstanceOf.

Doc from io.netty5.util.Send.referentIsInstanceOf.

Determine if the object received from this Send is an instance of the given class.

Parameters
cls:Class<?>

The type to check.

Returns:boolean

true if the object received from this Send can be assigned fields or variables of the given type, otherwise false.

Annotations
@Override