Class SendFromSupplier<T extends Resource<T>>

    • Constructor Detail

      • SendFromSupplier

        public SendFromSupplier​(Class<T> concreteObjectType,
                                Supplier<? extends T> supplier)
    • Method Detail

      • receive

        public T receive()
        Description copied from interface: Send
        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.

        Specified by:
        receive in interface Send<T extends Resource<T>>
        Returns:
        The sent resource instance, never null.
      • referentIsInstanceOf

        public boolean referentIsInstanceOf​(Class<?> cls)
        Description copied from interface: Send
        Determine if the object received from this Send is an instance of the given class.
        Specified by:
        referentIsInstanceOf in interface Send<T extends Resource<T>>
        Parameters:
        cls - The type to check.
        Returns:
        true if the object received from this Send can be assigned fields or variables of the given type, otherwise false.
      • close

        public void close()
        Description copied from interface: Send
        Discard this Send and the object it contains. This has no effect if the send-object has already been received.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface SafeCloseable
        Specified by:
        close in interface Send<T extends Resource<T>>