Class ShardingHintManager


  • public class ShardingHintManager
    extends Object
    Sharding Hint to set Database and Table shard suffix for the current thread. The values set for a particular query will be propagated to all the queries unless explicitly cleared.
    Author:
    Shashank Sharma
    • Constructor Detail

      • ShardingHintManager

        public ShardingHintManager()
    • Method Detail

      • setDatabaseHint

        public static void setDatabaseHint​(String databaseHint)
        Sets the Database Hint for the current thread.
        Parameters:
        databaseHint - Database Hint
      • setCollectionHint

        public static void setCollectionHint​(String collectionHint)
        Sets the Collection Hint for the current thread.
        Parameters:
        collectionHint - Collection Hint
      • setCompositeHint

        public static void setCompositeHint​(String databaseHint,
                                            String collectionHint)
        Set the composite hint for the current thread
        Parameters:
        databaseHint - database hint
        collectionHint - collection hint
      • getHint

        public static Optional<ShardingHint> getHint()
        Get the current Hint value if exists
        Returns:
        Optional Hint value
      • clear

        public static Optional<ShardingHint> clear()
        Clear the current value if exists and return the value before clearing
        Returns:
        Optional Hint value