Interface TableView<T>

All Superinterfaces:
AutoCloseable, Closeable

public interface TableView<T> extends Closeable
  • Method Summary

    Modifier and Type
    Method
    Description
    Close the table view and releases resources allocated.
    boolean
    Returns true if this TableView contains a mapping for the specified key.
    Returns a Set view of the mappings contained in this map.
    void
    Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
    void
    Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
    get(String key)
    Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
    boolean
    Returns true if this TableView contains no key-value mappings.
    Returns a Set view of the keys contained in this TableView.
    void
    Performs the given action for each future entry in this map until all entries have been processed or the action throws an exception.
    void
    Refresh the table view with the latest data in the topic, ensuring that all subsequent reads are based on the refreshed data.
    Refresh the table view with the latest data in the topic, ensuring that all subsequent reads are based on the refreshed data.
    int
    Returns the number of key-value mappings in the TableView.
    Returns a Collection view of the values contained in this TableView.

    Methods inherited from interface java.io.Closeable

    close
  • Method Details

    • size

      int size()
      Returns the number of key-value mappings in the TableView.
      Returns:
      the number of key-value mappings in this TableView
    • isEmpty

      boolean isEmpty()
      Returns true if this TableView contains no key-value mappings.
      Returns:
      true if this TableView contains no key-value mappings
    • containsKey

      boolean containsKey(String key)
      Returns true if this TableView contains a mapping for the specified key.
      Parameters:
      key - key whose presence in this map is to be tested
      Returns:
      true if this map contains a mapping for the specified key
    • get

      T get(String key)
      Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
      Parameters:
      key - the key whose associated value is to be returned
      Returns:
      the value associated with the key or null if the keys was not found
    • entrySet

      Set<Map.Entry<String,T>> entrySet()
      Returns a Set view of the mappings contained in this map.
      Returns:
      a set view of the mappings contained in this map
    • keySet

      Set<String> keySet()
      Returns a Set view of the keys contained in this TableView.
      Returns:
      a set view of the keys contained in this map
    • values

      Collection<T> values()
      Returns a Collection view of the values contained in this TableView.
      Returns:
      a collection view of the values contained in this TableView
    • forEach

      void forEach(BiConsumer<String,T> action)
      Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
      Parameters:
      action - The action to be performed for each entry
    • listen

      void listen(BiConsumer<String,T> action)
      Performs the given action for each future entry in this map until all entries have been processed or the action throws an exception.
      Parameters:
      action - The action to be performed for each entry
    • forEachAndListen

      void forEachAndListen(BiConsumer<String,T> action)
      Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
      Parameters:
      action - The action to be performed for each entry
    • closeAsync

      CompletableFuture<Void> closeAsync()
      Close the table view and releases resources allocated.
      Returns:
      a future that can used to track when the table view has been closed.
    • refreshAsync

      CompletableFuture<Void> refreshAsync()
      Refresh the table view with the latest data in the topic, ensuring that all subsequent reads are based on the refreshed data. Example usage: table.refreshAsync().thenApply(__ -> table.get(key)); This function retrieves the last written message in the topic and refreshes the table view accordingly. Once the refresh is complete, all subsequent reads will be performed on the refreshed data or a combination of the refreshed data and newly published data. The table view remains synchronized with any newly published data after the refresh. |x:0|->|y:0|->|z:0|->|x:1|->|z:1|->|x:2|->|y:1|->|y:2| If a read occurs after the refresh (at the last published message |y:2|), it ensures that outdated data like x=1 is not obtained. However, it does not guarantee that the values will always be x=2, y=2, z=1, as the table view may receive updates with newly published data. |x:0|->|y:0|->|z:0|->|x:1|->|z:1|->|x:2|->|y:1|->|y:2| -> |y:3| Both y=2 or y=3 are possible. Therefore, different readers may receive different values, but all values will be equal to or newer than the data refreshed from the last call to the refresh method.
    • refresh

      void refresh() throws PulsarClientException
      Refresh the table view with the latest data in the topic, ensuring that all subsequent reads are based on the refreshed data.
      Throws:
      PulsarClientException - if there is any error refreshing the table view.