Package org.kiwiproject.curator
Class CuratorFrameworkHelper
- java.lang.Object
-
- org.kiwiproject.curator.CuratorFrameworkHelper
-
public class CuratorFrameworkHelper extends Object
Helper class for managing the lifecycle ofCuratorFrameworkinstances.
-
-
Constructor Summary
Constructors Constructor Description CuratorFrameworkHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseIfStarted(org.apache.curator.framework.CuratorFramework client)Closes the specified Curator client, if it is in the STARTED state.voidcloseQuietly(org.apache.curator.framework.CuratorFramework client)Closes the specified Curator client, if it is non-null and in the STARTED state.org.apache.curator.framework.CuratorFrameworkcreateCuratorFramework(CuratorConfig curatorConfig)Creates a newCuratorFrameworkinstance.org.apache.curator.framework.CuratorFrameworkstartCuratorFramework(CuratorConfig curatorConfig)Creates and starts a new {Kink CuratorFramework} instance.
-
-
-
Method Detail
-
createCuratorFramework
public org.apache.curator.framework.CuratorFramework createCuratorFramework(CuratorConfig curatorConfig)
Creates a newCuratorFrameworkinstance. It is inCuratorFrameworkState.LATENTstate, meaning not yet started.- Parameters:
curatorConfig- Curator configuration- Returns:
- a Curator client
-
startCuratorFramework
public org.apache.curator.framework.CuratorFramework startCuratorFramework(CuratorConfig curatorConfig)
Creates and starts a new {Kink CuratorFramework} instance.It will be in the
CuratorFrameworkState.STARTEDstate.- Parameters:
curatorConfig- Curator configuration- Returns:
- a started Curator client
-
closeIfStarted
public void closeIfStarted(org.apache.curator.framework.CuratorFramework client)
Closes the specified Curator client, if it is in the STARTED state. Otherwise does nothing.- Parameters:
client- the Curator client to close
-
closeQuietly
public void closeQuietly(org.apache.curator.framework.CuratorFramework client)
Closes the specified Curator client, if it is non-null and in the STARTED state. Otherwise does nothing.- Parameters:
client- the Curator client to close, ornull- See Also:
closeIfStarted(CuratorFramework)
-
-