Class AbstractCuratorFrameworkBuilder

java.lang.Object
com.linecorp.armeria.common.zookeeper.AbstractCuratorFrameworkBuilder
Direct Known Subclasses:
ZooKeeperEndpointGroupBuilder, ZooKeeperUpdatingListenerBuilder

@UnstableApi public class AbstractCuratorFrameworkBuilder extends Object
A skeletal builder implementation for CuratorFramework.
  • Constructor Details

    • AbstractCuratorFrameworkBuilder

      protected AbstractCuratorFrameworkBuilder(String zkConnectionStr, String znodePath)
      Creates a new instance with the specified zkConnectionStr.
    • AbstractCuratorFrameworkBuilder

      protected AbstractCuratorFrameworkBuilder(org.apache.curator.framework.CuratorFramework client, String znodePath)
      Creates a new instance with the specified CuratorFramework.
  • Method Details

    • znodePath

      protected final String znodePath()
      Returns the znode Path.
    • connectTimeout

      public AbstractCuratorFrameworkBuilder connectTimeout(Duration connectTimeout)
      Sets the specified connect timeout. 1000 ms is used by default.
      Parameters:
      connectTimeout - the connect timeout
      Throws:
      IllegalStateException - if this builder was created with an existing CuratorFramework instance.
    • connectTimeoutMillis

      public AbstractCuratorFrameworkBuilder connectTimeoutMillis(long connectTimeoutMillis)
      Sets the specified connect timeout in milliseconds. 1000 ms is used by default.
      Parameters:
      connectTimeoutMillis - the connect timeout in milliseconds
      Throws:
      IllegalStateException - if this builder was created with an existing CuratorFramework instance.
    • sessionTimeout

      public AbstractCuratorFrameworkBuilder sessionTimeout(Duration sessionTimeout)
      Sets the session timeout. 10000 ms is used by default.
      Parameters:
      sessionTimeout - the session timeout
      Throws:
      IllegalStateException - if this builder was created with an existing CuratorFramework instance.
    • sessionTimeoutMillis

      public AbstractCuratorFrameworkBuilder sessionTimeoutMillis(long sessionTimeoutMillis)
      Sets the session timeout in milliseconds. 10000 ms is used by default.
      Parameters:
      sessionTimeoutMillis - the session timeout in milliseconds
      Throws:
      IllegalStateException - if this builder was created with an existing CuratorFramework instance.
    • customizer

      public AbstractCuratorFrameworkBuilder customizer(Consumer<? super org.apache.curator.framework.CuratorFrameworkFactory.Builder> customizer)
      Specifies the Consumer that customizes the CuratorFramework.
      Throws:
      IllegalStateException - if this builder was created with an existing CuratorFramework instance.
    • isUserSpecifiedCuratorFramework

      protected final boolean isUserSpecifiedCuratorFramework()
      Returns true if this builder is created with AbstractCuratorFrameworkBuilder(CuratorFramework, String).
    • buildCuratorFramework

      protected final org.apache.curator.framework.CuratorFramework buildCuratorFramework()
      Returns a newly-created CuratorFramework based on the configuration properties added to this builder if isUserSpecifiedCuratorFramework() is true. Otherwise, the CuratorFramework specified when creating this builder will be returned.