Class Publisher.OrderBy<V>

java.lang.Object
com.tangosol.net.topic.Publisher.OrderBy<V>
All Implemented Interfaces:
ExternalizableLite, PortableObject, Publisher.Option<V>, Serializable
Direct Known Subclasses:
Publisher.OrderById, Publisher.OrderByNone, Publisher.OrderByThread, Publisher.OrderByValue
Enclosing interface:
Publisher<V>

public abstract static class Publisher.OrderBy<V> extends Object implements Publisher.Option<V>, ExternalizableLite, PortableObject
The OrderBy option specifies the ordering of async operations with respect to one another. The default unit-of-order is thread() which ensures that a sequence of async operations issued by a single thread will complete in order. This default ordering does not however guarantee ordering with respect to other threads or processes which are also issuing operations against the same topic. To ensure strict global ordering across threads or processes all parties must specify the same unit-of-order id. Note that restricting the topic to a single unit-of-order naturally limits performance as it disallows full parallelism.
See Also:
  • Constructor Details

    • OrderBy

      protected OrderBy()
      Default constructor for serialization.
  • Method Details

    • getOrderId

      public abstract int getOrderId(V value)
      Return unit-of-order id.
      Returns:
      the unit-of-order id
    • thread

      @Default public static Publisher.OrderBy<Object> thread()
      Return an OrderBy that will ensure that all values sent from the same thread are stored sequentially.
      Returns:
      the default, thread-based ordering
    • none

      public static Publisher.OrderBy<Object> none()
      Return an OrderBy that will enforce no specific ordering between sent values allowing for the greatest level of parallelism.
      Returns:
      the OrderBy which does not enforce ordering
    • id

      public static Publisher.OrderBy<Object> id(int nOrderId)
      Return an OrderBy that will ensure ordering of sent values across all threads which share the same id.

      This option effectively publishes all messages to a single channel, the exact channel used is the specified nOrderId modulo the number of channels in the topic. Therefore a channel number can be used as the nOrderId parameter to ensure publishing to a specific channel.

      Parameters:
      nOrderId - the unit-of-order
      Returns:
      the order which will use specified nOrderId for all operations
    • value

      public static <V> Publisher.OrderBy<V> value(Remote.ToIntFunction<? super V> supplierOrderId)
      Return an OrderBy which will compute the unit-of-order based on the sent value.
      Parameters:
      supplierOrderId - the function that should be used to determine order id from the sent value.
      Returns:
      the order which will use specified function to provide unit-of-order for each async operation
    • value

      public static <V> Publisher.OrderBy<V> value(ToIntFunction<? super V> supplierOrderId)
      Return an OrderBy which will compute the unit-of-order based on the sent value.
      Parameters:
      supplierOrderId - the function that should be used to determine order id from the sent value.
      Returns:
      the order which will use specified function to provide unit-of-order for each async operation
    • roundRobin

      public static <V> Publisher.OrderBy<V> roundRobin()
      Return an OrderBy which will compute the unit-of-order such that each message is published to the next channel in a round robin order.
      Returns:
      an OrderBy which will compute the unit-of-order such that each message is published to the next channel in a round robin order.