Class CuratorFrameworkFactoryBean

java.lang.Object
org.springframework.integration.zookeeper.config.CuratorFrameworkFactoryBean
All Implemented Interfaces:
FactoryBean<org.apache.curator.framework.CuratorFramework>, Lifecycle, Phased, SmartLifecycle

public class CuratorFrameworkFactoryBean extends Object implements FactoryBean<org.apache.curator.framework.CuratorFramework>, SmartLifecycle
A Spring-friendly way to build a CuratorFramework and implementing SmartLifecycle.
Since:
4.2
Author:
Gary Russell, Artem Bilan, Christian Tzolov
  • Constructor Details

    • CuratorFrameworkFactoryBean

      public CuratorFrameworkFactoryBean(String connectionString)
      Construct an instance using the supplied connection string and using a default retry policy new ExponentialBackoffRetry(1000, 3).
      Parameters:
      connectionString - list of servers to connect to
    • CuratorFrameworkFactoryBean

      public CuratorFrameworkFactoryBean(String connectionString, org.apache.curator.RetryPolicy retryPolicy)
      Construct an instance using the supplied connection string and retry policy.
      Parameters:
      connectionString - list of servers to connect to
      retryPolicy - the retry policy
  • Method Details

    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface Phased
      Specified by:
      getPhase in interface SmartLifecycle
    • setPhase

      public void setPhase(int phase)
      Parameters:
      phase - the phase
      See Also:
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface Lifecycle
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface SmartLifecycle
    • setAutoStartup

      public void setAutoStartup(boolean autoStartup)
      Parameters:
      autoStartup - true to automatically start
      See Also:
    • start

      public void start()
      Specified by:
      start in interface Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface Lifecycle
    • getObject

      public org.apache.curator.framework.CuratorFramework getObject()
      Specified by:
      getObject in interface FactoryBean<org.apache.curator.framework.CuratorFramework>
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface FactoryBean<org.apache.curator.framework.CuratorFramework>