public void performBackgroundOperation()

in curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java [264:316]


    public void performBackgroundOperation(final OperationAndData<PathAndBytes> operationAndData) throws Exception {
        try {
            final OperationTrace trace =
                    client.getZookeeperClient().startAdvancedTracer("SetDataBuilderImpl-Background");
            final byte[] data = operationAndData.getData().getData();
            client.getZooKeeper()
                    .setData(
                            operationAndData.getData().getPath(),
                            data,
                            version,
                            new AsyncCallback.StatCallback() {
                                @SuppressWarnings({"unchecked"})
                                @Override
                                public void processResult(int rc, String path, Object ctx, Stat stat) {
                                    trace.setReturnCode(rc)
                                            .setRequestBytesLength(data)
                                            .setPath(path)
                                            .setStat(stat)
                                            .commit();
                                    if ((rc == KeeperException.Code.OK.intValue()) && failNextSetForTesting) {
                                        failNextSetForTesting = false;
                                        rc = KeeperException.Code.CONNECTIONLOSS.intValue();
                                    }

                                    if (rc == KeeperException.Code.BADVERSION.intValue() && idempotent) {
                                        backgroundCheckIdempotent(
                                                client,
                                                operationAndData,
                                                operationAndData.getData().getPath(),
                                                backgrounding);
                                    } else {
                                        CuratorEvent event = new CuratorEventImpl(
                                                client,
                                                CuratorEventType.SET_DATA,
                                                rc,
                                                path,
                                                null,
                                                ctx,
                                                stat,
                                                null,
                                                null,
                                                null,
                                                null,
                                                null);
                                        client.processBackgroundOperation(operationAndData, event);
                                    }
                                }
                            },
                            backgrounding.getContext());
        } catch (Throwable e) {
            backgrounding.checkError(e, null);
        }
    }