Examples of TimeTrace


Examples of org.apache.curator.TimeTrace

        return children;
    }

    private List<String> pathInForeground(final String path) throws Exception
    {
        TimeTrace       trace = client.getZookeeperClient().startTracer("GetChildrenBuilderImpl-Foreground");
        List<String>    children = RetryLoop.callWithRetry
        (
            client.getZookeeperClient(),
            new Callable<List<String>>()
            {
                @Override
                public List<String> call() throws Exception
                {
                    List<String>    children;
                    if ( watching.isWatched() )
                    {
                        children = client.getZooKeeper().getChildren(path, true, responseStat);
                    }
                    else
                    {
                        children = client.getZooKeeper().getChildren(path, watching.getWatcher(), responseStat);
                    }
                    return children;
                }
            }
        );
        trace.commit();
        return children;
    }
View Full Code Here

Examples of org.apache.curator.TimeTrace

                @Override
                public Void apply(CuratorListener listener)
                {
                    try
                    {
                        TimeTrace trace = client.startTracer("EventListener");
                        listener.eventReceived(CuratorFrameworkImpl.this, curatorEvent);
                        trace.commit();
                    }
                    catch ( Exception e )
                    {
                        logError("Event listener threw exception", e);
                    }
View Full Code Here

Examples of org.apache.curator.TimeTrace

    }

    @Override
    public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception
    {
        final TimeTrace             trace = client.getZookeeperClient().startTracer("GetACLBuilderImpl-Background");
        AsyncCallback.ACLCallback   callback = new AsyncCallback.ACLCallback()
        {
            @Override
            public void processResult(int rc, String path, Object ctx, List<ACL> acl, Stat stat)
            {
                trace.commit();
                CuratorEventImpl event = new CuratorEventImpl(client, CuratorEventType.GET_ACL, rc, path, null, ctx, stat, null, null, null, acl);
                client.processBackgroundOperation(operationAndData, event);
            }
        };
        client.getZooKeeper().getACL(operationAndData.getData(), responseStat, callback, backgrounding.getContext());
View Full Code Here

Examples of org.apache.curator.TimeTrace

        return result;
    }

    private List<ACL> pathInForeground(final String path) throws Exception
    {
        TimeTrace    trace = client.getZookeeperClient().startTracer("GetACLBuilderImpl-Foreground");
        List<ACL>    result = RetryLoop.callWithRetry
        (
            client.getZookeeperClient(),
            new Callable<List<ACL>>()
            {
                @Override
                public List<ACL> call() throws Exception
                {
                    return client.getZooKeeper().getACL(path, responseStat);
                }
            }
        );
        trace.commit();
        return result;
    }
View Full Code Here

Examples of org.apache.curator.TimeTrace

    }

    @Override
    public void performBackgroundOperation(final OperationAndData<PathAndBytes> operationAndData) throws Exception
    {
        final TimeTrace   trace = client.getZookeeperClient().startTracer("CreateBuilderImpl-Background");
        client.getZooKeeper().create
        (
            operationAndData.getData().getPath(),
            operationAndData.getData().getData(),
            acling.getAclList(operationAndData.getData().getPath()),
            createMode,
            new AsyncCallback.StringCallback()
            {
                @Override
                public void processResult(int rc, String path, Object ctx, String name)
                {
                    trace.commit();

                    if ( (rc == KeeperException.Code.NONODE.intValue()) && createParentsIfNeeded )
                    {
                        backgroundCreateParentsThenNode(operationAndData);
                    }
View Full Code Here

Examples of org.apache.curator.TimeTrace

        client.processBackgroundOperation(operationAndData, null);
    }

    private String pathInForeground(final String path, final byte[] data) throws Exception
    {
        TimeTrace               trace = client.getZookeeperClient().startTracer("CreateBuilderImpl-Foreground");

        final AtomicBoolean     firstTime = new AtomicBoolean(true);
        String                  returnPath = RetryLoop.callWithRetry
        (
            client.getZookeeperClient(),
            new Callable<String>()
            {
                @Override
                public String call() throws Exception
                {
                    boolean   localFirstTime = firstTime.getAndSet(false);

                    String    createdPath = null;
                    if ( !localFirstTime && doProtected )
                    {
                        createdPath = findProtectedNodeInForeground(path);
                    }

                    if ( createdPath == null )
                    {
                        try
                        {
                            createdPath = client.getZooKeeper().create(path, data, acling.getAclList(path), createMode);
                        }
                        catch ( KeeperException.NoNodeException e )
                        {
                            if ( createParentsIfNeeded )
                            {
                                ZKPaths.mkdirs(client.getZooKeeper(), path, false);
                                createdPath = client.getZooKeeper().create(path, data, acling.getAclList(path), createMode);
                            }
                            else
                            {
                                throw e;
                            }
                        }
                    }

                    if ( failNextCreateForTesting )
                    {
                        failNextCreateForTesting = false;
                        throw new KeeperException.ConnectionLossException();
                    }
                    return createdPath;
                }
            }
        );

        trace.commit();
        return returnPath;
    }
View Full Code Here

Examples of org.apache.curator.TimeTrace

        return returnPath;
    }

    private String  findProtectedNodeInForeground(final String path) throws Exception
    {
        TimeTrace       trace = client.getZookeeperClient().startTracer("CreateBuilderImpl-findProtectedNodeInForeground");

        String          returnPath = RetryLoop.callWithRetry
        (
            client.getZookeeperClient(),
            new Callable<String>()
            {
                @Override
                public String call() throws Exception
                {
                    String foundNode = null;
                    try
                    {
                        final ZKPaths.PathAndNode   pathAndNode = ZKPaths.getPathAndNode(path);
                        List<String>                children = client.getZooKeeper().getChildren(pathAndNode.getPath(), false);

                        final String                protectedPrefix = getProtectedPrefix();
                        foundNode = Iterables.find
                        (
                            children,
                            new Predicate<String>()
                            {
                                @Override
                                public boolean apply(String node)
                                {
                                    return node.startsWith(protectedPrefix);
                                }
                            },
                            null
                        );
                        if ( foundNode != null )
                        {
                            foundNode = ZKPaths.makePath(pathAndNode.getPath(), foundNode);
                        }
                    }
                    catch ( KeeperException.NoNodeException ignore )
                    {
                        // ignore
                    }
                    return foundNode;
                }
            }
        );

        trace.commit();
        return returnPath;
    }
View Full Code Here

Examples of org.apache.curator.TimeTrace

    }

    @Override
    public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception
    {
        final TimeTrace   trace = client.getZookeeperClient().startTracer("GetDataBuilderImpl-Background");
        AsyncCallback.DataCallback callback = new AsyncCallback.DataCallback()
        {
            @Override
            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);
View Full Code Here

Examples of org.apache.curator.TimeTrace

        return responseData;
    }

    private byte[] pathInForeground(final String path) throws Exception
    {
        TimeTrace   trace = client.getZookeeperClient().startTracer("GetDataBuilderImpl-Foreground");
        byte[]      responseData = RetryLoop.callWithRetry
        (
            client.getZookeeperClient(),
            new Callable<byte[]>()
            {
                @Override
                public byte[] call() throws Exception
                {
                    byte[]      responseData;
                    if ( watching.isWatched() )
                    {
                        responseData = client.getZooKeeper().getData(path, true, responseStat);
                    }
                    else
                    {
                        responseData = client.getZooKeeper().getData(path, watching.getWatcher(), responseStat);
                    }
                    return responseData;
                }
            }
        );
        trace.commit();

        return decompress ? client.getCompressionProvider().decompress(path, responseData) : responseData;
    }
View Full Code Here

Examples of org.apache.curator.TimeTrace

    }

    @Override
    public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception
    {
        final TimeTrace trace = client.getZookeeperClient().startTracer("SyncBuilderImpl-Background");
        final String path = operationAndData.getData();
        String adjustedPath = client.fixForNamespace(path);

        AsyncCallback.VoidCallback voidCallback = new AsyncCallback.VoidCallback()
        {
            @Override
            public void processResult(int rc, String path, Object ctx)
            {
                trace.commit();
                CuratorEvent event = new CuratorEventImpl(client, CuratorEventType.SYNC, rc, path, path, ctx, null, null, null, null, null);
                client.processBackgroundOperation(operationAndData, event);
            }
        };
        client.getZooKeeper().sync(adjustedPath, voidCallback, backgrounding.getContext());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.