Interface CreateBuilderMainShim

  • All Superinterfaces:
    org.apache.curator.framework.api.ACLable<org.apache.curator.framework.api.BackgroundPathAndBytesable<java.lang.String>>, org.apache.curator.framework.api.ACLBackgroundPathAndBytesable<java.lang.String>, org.apache.curator.framework.api.ACLCreateModeBackgroundPathAndBytesable<java.lang.String>, org.apache.curator.framework.api.Backgroundable<org.apache.curator.framework.api.ErrorListenerPathAndBytesable<java.lang.String>>, org.apache.curator.framework.api.BackgroundPathAndBytesable<java.lang.String>, org.apache.curator.framework.api.Compressible<org.apache.curator.framework.api.CreateBackgroundModeACLable>, org.apache.curator.framework.api.CreateModable<org.apache.curator.framework.api.ACLBackgroundPathAndBytesable<java.lang.String>>, org.apache.curator.framework.api.ParentACLable<org.apache.curator.framework.api.BackgroundPathAndBytesable<java.lang.String>>, org.apache.curator.framework.api.PathAndBytesable<java.lang.String>
    All Known Subinterfaces:
    CreateBuilderShim

    public interface CreateBuilderMainShim
    extends org.apache.curator.framework.api.BackgroundPathAndBytesable<java.lang.String>, org.apache.curator.framework.api.CreateModable<org.apache.curator.framework.api.ACLBackgroundPathAndBytesable<java.lang.String>>, org.apache.curator.framework.api.ACLCreateModeBackgroundPathAndBytesable<java.lang.String>, org.apache.curator.framework.api.Compressible<org.apache.curator.framework.api.CreateBackgroundModeACLable>
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable<java.lang.String> creatingParentContainersIfNeeded()
      Causes any parent nodes to get created using CreateMode#CONTAINER if they haven't already been.
      org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable<java.lang.String> creatingParentsIfNeeded()
      Causes any parent nodes to get created if they haven't already been
      org.apache.curator.framework.api.ACLPathAndBytesable<java.lang.String> withProtectedEphemeralSequential()
      Deprecated.
      this has been generalized to support all create modes.
      org.apache.curator.framework.api.ACLCreateModeBackgroundPathAndBytesable<java.lang.String> withProtection()
      Hat-tip to https://github.com/sbridges for pointing this out
      • Methods inherited from interface org.apache.curator.framework.api.ACLable

        withACL
      • Methods inherited from interface org.apache.curator.framework.api.Backgroundable

        inBackground, inBackground, inBackground, inBackground, inBackground, inBackground
      • Methods inherited from interface org.apache.curator.framework.api.Compressible

        compressed
      • Methods inherited from interface org.apache.curator.framework.api.CreateModable

        withMode
      • Methods inherited from interface org.apache.curator.framework.api.ParentACLable

        withACL
      • Methods inherited from interface org.apache.curator.framework.api.PathAndBytesable

        forPath, forPath
    • Method Detail

      • creatingParentsIfNeeded

        org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable<java.lang.String> creatingParentsIfNeeded()
        Causes any parent nodes to get created if they haven't already been
        Returns:
        this
      • creatingParentContainersIfNeeded

        org.apache.curator.framework.api.ProtectACLCreateModePathAndBytesable<java.lang.String> creatingParentContainersIfNeeded()
        Causes any parent nodes to get created using CreateMode#CONTAINER if they haven't already been. IMPORTANT NOTE: container creation is a new feature in recent versions of ZooKeeper. If the ZooKeeper version you're using does not support containers, the parent nodes are created as ordinary PERSISTENT nodes.
        Returns:
        this
      • withProtectedEphemeralSequential

        @Deprecated
        org.apache.curator.framework.api.ACLPathAndBytesable<java.lang.String> withProtectedEphemeralSequential()
        Deprecated.
        this has been generalized to support all create modes. Instead, use:
             client.create().withProtection().withMode(CreateMode.EPHEMERAL_SEQUENTIAL)...
                     
        Returns:
        this
      • withProtection

        org.apache.curator.framework.api.ACLCreateModeBackgroundPathAndBytesable<java.lang.String> withProtection()
        Hat-tip to https://github.com/sbridges for pointing this out

        It turns out there is an edge case that exists when creating sequential-ephemeral nodes. The creation can succeed on the server, but the server can crash before the created node name is returned to the client. However, the ZK session is still valid so the ephemeral node is not deleted. Thus, there is no way for the client to determine what node was created for them.

        Even without sequential-ephemeral, however, the create can succeed on the sever but the client (for various reasons) will not know it.

        Putting the create builder into protection mode works around this. The name of the node that is created is prefixed with a GUID. If node creation fails the normal retry mechanism will occur. On the retry, the parent path is first searched for a node that has the GUID in it. If that node is found, it is assumed to be the lost node that was successfully created on the first try and is returned to the caller.

        Returns:
        this