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
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorDescriptionCuratorFrameworkFactoryBean
(String connectionString) Construct an instance using the supplied connection string and using a default retry policynew ExponentialBackoffRetry(1000, 3)
.CuratorFrameworkFactoryBean
(String connectionString, org.apache.curator.RetryPolicy retryPolicy) Construct an instance using the supplied connection string and retry policy. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.FactoryBean
isSingleton
Methods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Constructor Details
-
CuratorFrameworkFactoryBean
Construct an instance using the supplied connection string and using a default retry policynew 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 toretryPolicy
- the retry policy
-
-
Method Details
-
getPhase
public int getPhase()- Specified by:
getPhase
in interfacePhased
- Specified by:
getPhase
in interfaceSmartLifecycle
-
setPhase
public void setPhase(int phase) - Parameters:
phase
- the phase- See Also:
-
isRunning
public boolean isRunning() -
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceSmartLifecycle
-
setAutoStartup
public void setAutoStartup(boolean autoStartup) - Parameters:
autoStartup
- true to automatically start- See Also:
-
start
public void start() -
stop
public void stop() -
getObject
public org.apache.curator.framework.CuratorFramework getObject()- Specified by:
getObject
in interfaceFactoryBean<org.apache.curator.framework.CuratorFramework>
-
getObjectType
- Specified by:
getObjectType
in interfaceFactoryBean<org.apache.curator.framework.CuratorFramework>
-