public interface CreateBuilderMain extends BackgroundPathAndBytesable<String>, CreateModable<ACLBackgroundPathAndBytesable<String>>, ACLCreateModeBackgroundPathAndBytesable<String>, Compressible<CreateBackgroundModeStatACLable>, Statable<CreateProtectACLCreateModePathAndBytesable<String>>
Modifier and Type | Method and Description |
---|---|
ProtectACLCreateModeStatPathAndBytesable<String> |
creatingParentContainersIfNeeded()
Causes any parent nodes to get created using
CreateMode.CONTAINER if they haven't already been. |
ProtectACLCreateModeStatPathAndBytesable<String> |
creatingParentsIfNeeded()
Causes any parent nodes to get created if they haven't already been
|
ACLPathAndBytesable<String> |
withProtectedEphemeralSequential()
Deprecated.
this has been generalized to support all create modes. Instead, use:
client.create().withProtection().withMode(CreateMode.EPHEMERAL_SEQUENTIAL)... |
ACLCreateModeStatBackgroundPathAndBytesable<String> |
withProtection()
Hat-tip to https://github.com/sbridges for pointing this out
|
withACL
inBackground, inBackground, inBackground, inBackground, inBackground, inBackground
forPath, forPath
withMode
compressed
storingStatIn
ProtectACLCreateModeStatPathAndBytesable<String> creatingParentsIfNeeded()
ProtectACLCreateModeStatPathAndBytesable<String> creatingParentContainersIfNeeded()
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.@Deprecated ACLPathAndBytesable<String> withProtectedEphemeralSequential()
client.create().withProtection().withMode(CreateMode.EPHEMERAL_SEQUENTIAL)...
ACLCreateModeStatBackgroundPathAndBytesable<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 40 characters string that is the concatenation of
UUID.toString()
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.