Module io.netty5.common
Package io.netty5.util.internal
Class SendFromSupplier<T extends Resource<T>>
- java.lang.Object
-
- io.netty5.util.internal.SendFromSupplier<T>
-
- All Implemented Interfaces:
SafeCloseable
,Send<T>
,AutoCloseable
public class SendFromSupplier<T extends Resource<T>> extends Object implements Send<T>
-
-
Constructor Summary
Constructors Constructor Description SendFromSupplier(Class<T> concreteObjectType, Supplier<? extends T> supplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Discard thisSend
and the object it contains.T
receive()
Receive theResource
instance being sent, and bind its ownership to the calling thread.boolean
referentIsInstanceOf(Class<?> cls)
Determine if the object received from thisSend
is an instance of the given class.
-
-
-
Method Detail
-
receive
public T receive()
Description copied from interface:Send
Receive theResource
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.
-
referentIsInstanceOf
public boolean referentIsInstanceOf(Class<?> cls)
Description copied from interface:Send
Determine if the object received from thisSend
is an instance of the given class.- Specified by:
referentIsInstanceOf
in interfaceSend<T extends Resource<T>>
- Parameters:
cls
- The type to check.- Returns:
true
if the object received from thisSend
can be assigned fields or variables of the given type, otherwise false.
-
close
public void close()
Description copied from interface:Send
Discard thisSend
and the object it contains. This has no effect if the send-object has already been received.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSafeCloseable
- Specified by:
close
in interfaceSend<T extends Resource<T>>
-
-