Esempio n. 1
0
 public void processResult(int rc, String path, Object ctx, byte[] data, Stat stat)
 {
     trace.commit();
     if (decompress && (data != null))
     {
         try
         {
             data = client.getCompressionProvider().decompress(path, data);
         }
         catch (Exception e)
         {
             ThreadUtils.checkInterrupted(e);
             log.error("Decompressing for path: " + path, e);
             rc = KeeperException.Code.DATAINCONSISTENCY.intValue();
         }
     }
     CuratorEvent event = new CuratorEventImpl(client, CuratorEventType.GET_DATA, rc, path, null, ctx, stat, data, null, null, null);
Esempio n. 2
0
        public Stat forPath(String path, byte[] data)
        {
            if (compress)
            {
                data = client.getCompressionProvider().compress(path, data);
            }

            path = client.fixForNamespace(path);

            Stat resultStat = null;

            if (backgrounding.inBackground())
            {
                client.processBackgroundOperation(new OperationAndData <PathAndBytes>(this, new PathAndBytes(path, data), backgrounding.getCallback(), null, backgrounding.getContext()), null);
            }
            else
            {
                resultStat = pathInForeground(path, data);
            }
            return(resultStat);
        }
Esempio n. 3
0
        public String forPath(String givenPath, byte[] data)
        {
            if (compress)
            {
                data = client.getCompressionProvider().compress(givenPath, data);
            }

            String adjustedPath = adjustPath(client.fixForNamespace(givenPath, createMode.isSequential()));

            String returnPath = null;

            if (backgrounding.inBackground())
            {
                pathInBackground(adjustedPath, data, givenPath);
            }
            else
            {
                String path = protectedPathInForeground(adjustedPath, data);
                returnPath = client.unfixForNamespace(path);
            }
            return(returnPath);
        }
Esempio n. 4
0
        public byte[] forPath(String path)
        {
            String localPath = client.fixForNamespace(path);

            TimeTrace trace = client.getZookeeperClient().startTracer("GetDataBuilderImpl-Foreground");

            byte[]
            responseData = RetryLoop.callWithRetry
                           (
                client.getZookeeperClient(),
                CallableUtils.FromFunc(() =>
            {
                var dataAsync = client.getZooKeeper().getDataAsync(localPath, false);
                dataAsync.Wait();
                responseStat = dataAsync.Result.Stat;
                return(dataAsync.Result.Data);
            })
                           );
            trace.commit();

            return(decompress
                    ? client.getCompressionProvider().decompress(path, responseData)
                    : responseData);
        }