Class IncomingData.NullIncomingData<DATATYPE extends Data>

  • All Implemented Interfaces:
    IncomingData<DATATYPE>
    Enclosing interface:
    IncomingData<DATATYPE extends Data>

    public static final class IncomingData.NullIncomingData<DATATYPE extends Data>
    extends java.lang.Object
    implements IncomingData<DATATYPE>
    Creates a null implementation of this which is empty and complete at creation:
    • Provides immediate return without incurring any memory synchronization for any read method.
    • Throws an exception on any write method

    This allows consumers to check for completion the same way whether or not the data list in question supports asynchronous addition of data, and without incurring unnecessary costs.

    • Constructor Detail

    • Method Detail

      • completed

        public com.google.common.util.concurrent.ListenableFuture<DataList<DATATYPE>> completed()
        Description copied from interface: IncomingData
        Returns a future in which all the incoming data that will be produced in this is available. Listeners on this are invoked on the thread producing the incoming data (or a thread spawned from it), which in general is separate from the thread using the data list. Hence, listeners on this even cannot in general assume that they may modify the data list or the request.

        The data is not drained into the owner of this by this method. That must be done by the thread using the data list.

        This return the list owning this for convenience.

        Specified by:
        completed in interface IncomingData<DATATYPE extends Data>
      • getOwner

        public DataList<DATATYPE> getOwner()
        Description copied from interface: IncomingData
        Returns the owner (target DataList) of this. Note that accessing the owner from the thread producing incoming data is generally *not* thread safe.
        Specified by:
        getOwner in interface IncomingData<DATATYPE extends Data>
      • addLast

        public void addLast​(DATATYPE data)
        Description copied from interface: IncomingData
        Add new data and mark this as completed
        Specified by:
        addLast in interface IncomingData<DATATYPE extends Data>
        Throws:
        java.lang.IllegalStateException - as this is read only
      • add

        public void add​(DATATYPE data)
        Description copied from interface: IncomingData
        Add new data without completing this
        Specified by:
        add in interface IncomingData<DATATYPE extends Data>
        Throws:
        java.lang.IllegalStateException - as this is read only
      • addLast

        public void addLast​(java.util.List<DATATYPE> data)
        Description copied from interface: IncomingData
        Add new data and mark this as completed
        Specified by:
        addLast in interface IncomingData<DATATYPE extends Data>
        Throws:
        java.lang.IllegalStateException - as this is read only
      • add

        public void add​(java.util.List<DATATYPE> data)
        Description copied from interface: IncomingData
        Add new data without completing this.
        Specified by:
        add in interface IncomingData<DATATYPE extends Data>
        Throws:
        java.lang.IllegalStateException - as this is read only
      • addNewDataListener

        public void addNewDataListener​(java.lang.Runnable listener,
                                       java.util.concurrent.Executor executor)
        Adds a new data listener to this - this is a no-op as new data can never be added to this implementation.
        Specified by:
        addNewDataListener in interface IncomingData<DATATYPE extends Data>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object