Java 类org.apache.zookeeper.txn.SetACLTxn 实例源码

项目:fuck_zookeeper    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:ZooKeeper    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:StreamProcessingInfrastructure    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:bigstreams    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:bigstreams    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:bigstreams    文件:DataTree.java   
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
            case OpCode.create:
                CreateTxn createTxn = (CreateTxn) txn;
                debug = "Create transaction for " + createTxn.getPath();
                rc.path = createTxn.getPath();
                createNode(
                        createTxn.getPath(),
                        createTxn.getData(),
                        createTxn.getAcl(),
                        createTxn.getEphemeral() ? header.getClientId() : 0,
                        createTxn.getParentCVersion(),
                        header.getZxid(), header.getTime());
                break;
            case OpCode.delete:
                DeleteTxn deleteTxn = (DeleteTxn) txn;
                debug = "Delete transaction for " + deleteTxn.getPath();
                rc.path = deleteTxn.getPath();
                deleteNode(deleteTxn.getPath(), header.getZxid());
                break;
            case OpCode.setData:
                SetDataTxn setDataTxn = (SetDataTxn) txn;
                debug = "Set data for  transaction for "
                        + setDataTxn.getPath();
                rc.stat = setData(setDataTxn.getPath(), setDataTxn
                        .getData(), setDataTxn.getVersion(), header
                        .getZxid(), header.getTime());
                break;
            case OpCode.setACL:
                SetACLTxn setACLTxn = (SetACLTxn) txn;
                debug = "Set ACL for  transaction for "
                        + setACLTxn.getPath();
                rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                        setACLTxn.getVersion());
                break;
            case OpCode.closeSession:
                killSession(header.getClientId(), header.getZxid());
                break;
            case OpCode.error:
                ErrorTxn errTxn = (ErrorTxn) txn;
                rc.err = errTxn.getErr();
                break;
        }
    } catch (KeeperException e) {
         LOG.debug("Failed: " + debug, e);
         rc.err = e.code().intValue();
    }
    return rc;
}
项目:zookeeper-src-learning    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:zookeeper    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:StreamBench    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:ACaZoo    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:LoadBalanced_zk    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:LoadBalanced_zk    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:zookeeper.dsc    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}
项目:zookeeper.dsc    文件:DataTree.java   
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
            case OpCode.create:
                CreateTxn createTxn = (CreateTxn) txn;
                debug = "Create transaction for " + createTxn.getPath();
                rc.path = createTxn.getPath();
                createNode(
                        createTxn.getPath(),
                        createTxn.getData(),
                        createTxn.getAcl(),
                        createTxn.getEphemeral() ? header.getClientId() : 0,
                        header.getZxid(), header.getTime());
                break;
            case OpCode.delete:
                DeleteTxn deleteTxn = (DeleteTxn) txn;
                debug = "Delete transaction for " + deleteTxn.getPath();
                rc.path = deleteTxn.getPath();
                deleteNode(deleteTxn.getPath(), header.getZxid());
                break;
            case OpCode.setData:
                SetDataTxn setDataTxn = (SetDataTxn) txn;
                debug = "Set data for  transaction for "
                        + setDataTxn.getPath();
                rc.stat = setData(setDataTxn.getPath(), setDataTxn
                        .getData(), setDataTxn.getVersion(), header
                        .getZxid(), header.getTime());
                break;
            case OpCode.setACL:
                SetACLTxn setACLTxn = (SetACLTxn) txn;
                debug = "Set ACL for  transaction for "
                        + setACLTxn.getPath();
                rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                        setACLTxn.getVersion());
                break;
            case OpCode.closeSession:
                killSession(header.getClientId(), header.getZxid());
                break;
            case OpCode.error:
                ErrorTxn errTxn = (ErrorTxn) txn;
                rc.err = errTxn.getErr();
                break;
        }
    } catch (KeeperException e) {
         LOG.debug("Failed: " + debug, e);
         rc.err = e.code().intValue();
    }
    return rc;
}
项目:zookeeper-pkg    文件:DataTreeV1.java   
@SuppressWarnings("unchecked")
public ProcessTxnResult processTxn(TxnHeader header, Record txn) {
    ProcessTxnResult rc = new ProcessTxnResult();

    String debug = "";
    try {
        rc.clientId = header.getClientId();
        rc.cxid = header.getCxid();
        rc.zxid = header.getZxid();
        rc.type = header.getType();
        rc.err = 0;
        if (rc.zxid > lastProcessedZxid) {
            lastProcessedZxid = rc.zxid;
        }
        switch (header.getType()) {
        case OpCode.create:
            CreateTxn createTxn = (CreateTxn) txn;
            debug = "Create transaction for " + createTxn.getPath();
            createNode(createTxn.getPath(), createTxn.getData(), createTxn
                    .getAcl(), createTxn.getEphemeral() ? header
                    .getClientId() : 0, header.getZxid(), header.getTime());
            rc.path = createTxn.getPath();
            break;
        case OpCode.delete:
            DeleteTxn deleteTxn = (DeleteTxn) txn;
            debug = "Delete transaction for " + deleteTxn.getPath();
            deleteNode(deleteTxn.getPath());
            break;
        case OpCode.setData:
            SetDataTxn setDataTxn = (SetDataTxn) txn;
            debug = "Set data for  transaction for " + setDataTxn.getPath();
            rc.stat = setData(setDataTxn.getPath(), setDataTxn.getData(),
                    setDataTxn.getVersion(), header.getZxid(), header
                            .getTime());
            break;
        case OpCode.setACL:
            SetACLTxn setACLTxn = (SetACLTxn) txn;
            debug = "Set ACL for  transaction for " + setACLTxn.getPath();
            rc.stat = setACL(setACLTxn.getPath(), setACLTxn.getAcl(),
                    setACLTxn.getVersion());
            break;
        case OpCode.closeSession:
            killSession(header.getClientId());
            break;
        case OpCode.error:
            ErrorTxn errTxn = (ErrorTxn) txn;
            rc.err = errTxn.getErr();
            break;
        }
    } catch (KeeperException e) {
        // These are expected errors since we take a lazy snapshot
        if (initialized
                || (e.code() != Code.NONODE 
                        && e.code() != Code.NODEEXISTS)) {
            LOG.warn("Failed:" + debug, e);
        }
    }
    return rc;
}