Class CuratorFrameworkHelper


  • public class CuratorFrameworkHelper
    extends Object
    Helper class for managing the lifecycle of CuratorFramework instances.
    • Constructor Detail

      • CuratorFrameworkHelper

        public CuratorFrameworkHelper()
    • Method Detail

      • createCuratorFramework

        public org.apache.curator.framework.CuratorFramework createCuratorFramework​(CuratorConfig curatorConfig)
        Creates a new CuratorFramework instance. It is in CuratorFrameworkState.LATENT state, 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.STARTED state.

        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, or null
        See Also:
        closeIfStarted(CuratorFramework)