/** * @param client curztor client * @param path the full path to the node to cache * @param dataIsCompressed if true, data in the path is compressed */ public NodeCache(CuratorFramework client, String path, boolean dataIsCompressed) { this.client = client; this.path = path; this.dataIsCompressed = dataIsCompressed; ensurePath = client.newNamespaceAwareEnsurePath(path).excludingLast(); }
/** * Creates in mutex promotion mode. The optimistic lock will be tried first using * the given retry policy. If the increment does not succeed, a {@link InterProcessMutex} will be tried * with its own retry policy * * @param client the client * @param path path to hold the value * @param retryPolicy the retry policy to use * @param promotedToLock the arguments for the mutex promotion */ public DistributedAtomicValue(CuratorFramework client, String path, RetryPolicy retryPolicy, PromotedToLock promotedToLock) { this.client = client; this.path = path; this.retryPolicy = retryPolicy; this.promotedToLock = promotedToLock; mutex = (promotedToLock != null) ? new InterProcessMutex(client, promotedToLock.getPath()) : null; ensurePath = client.newNamespaceAwareEnsurePath(path).excludingLast(); }