当前位置: 首页>>代码示例>>Java>>正文


Java SetDataRequest类代码示例

本文整理汇总了Java中org.apache.zookeeper.proto.SetDataRequest的典型用法代码示例。如果您正苦于以下问题:Java SetDataRequest类的具体用法?Java SetDataRequest怎么用?Java SetDataRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SetDataRequest类属于org.apache.zookeeper.proto包,在下文中一共展示了SetDataRequest类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setData

import org.apache.zookeeper.proto.SetDataRequest; //导入依赖的package包/类
/**
 * The asynchronous version of setData.
 *
 * @see #setData(String, byte[], int)
 */
public void setData(final String path, byte data[], int version,
        StatCallback cb, Object ctx)
{
    final String clientPath = path;
    PathUtils.validatePath(clientPath);

    final String serverPath = prependChroot(clientPath);

    RequestHeader h = new RequestHeader();
    h.setType(ZooDefs.OpCode.setData);
    SetDataRequest request = new SetDataRequest();
    request.setPath(serverPath);
    request.setData(data);
    request.setVersion(version);
    SetDataResponse response = new SetDataResponse();
    cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
            clientPath, serverPath, ctx, null);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:24,代码来源:ZooKeeper.java

示例2: setData

import org.apache.zookeeper.proto.SetDataRequest; //导入依赖的package包/类
/**
 * The Asynchronous version of setData. The request doesn't actually until
 * the asynchronous callback is called.
 *
 * @see #setData(String, byte[], int)
 */
public void setData(final String path, byte data[], int version,
        StatCallback cb, Object ctx)
{
    final String clientPath = path;
    PathUtils.validatePath(clientPath);

    final String serverPath = prependChroot(clientPath);

    RequestHeader h = new RequestHeader();
    h.setType(ZooDefs.OpCode.setData);
    SetDataRequest request = new SetDataRequest();
    request.setPath(serverPath);
    request.setData(data);
    request.setVersion(version);
    SetDataResponse response = new SetDataResponse();
    cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
            clientPath, serverPath, ctx, null);
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:25,代码来源:ZooKeeper.java

示例3: testInvalidPath

import org.apache.zookeeper.proto.SetDataRequest; //导入依赖的package包/类
/**
 * It tests that PrepRequestProcessor will return BadArgument KeeperException
 * if the request path (if it exists) is not valid, e.g. empty string.
 */
@Test
public void testInvalidPath() throws Exception {
    pLatch = new CountDownLatch(1);
    processor = new PrepRequestProcessor(zks, new MyRequestProcessor());

    SetDataRequest record = new SetDataRequest("", new byte[0], -1);
    Request req = createRequest(record, OpCode.setData);
    processor.pRequest(req);
    pLatch.await();
    Assert.assertEquals(outcome.hdr.getType(), OpCode.error);
    Assert.assertEquals(outcome.getException().code(), KeeperException.Code.BADARGUMENTS);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:17,代码来源:PrepRequestProcessorTest.java

示例4: committedAndUncommittedOfTheSameSessionRaceTest

import org.apache.zookeeper.proto.SetDataRequest; //导入依赖的package包/类
/**
 * We place a read request followed by committed update request of the same
 * session in queuedRequests. We verify that both requests are processed,
 * according to the order of the session (first read, then the write).
 */
@Test
public void committedAndUncommittedOfTheSameSessionRaceTest()
        throws Exception {
    final String path = "/testCvsUCRace";

    Request readReq = newRequest(new GetDataRequest(path, false),
            OpCode.getData, 0x0, 0);
    Request writeReq = newRequest(
            new SetDataRequest(path, new byte[16], -1), OpCode.setData, 0x0,
            1);

    processor.committedRequests.add(writeReq);
    processor.queuedRequests.add(readReq);
    processor.queuedRequests.add(writeReq);
    processor.initThreads(1);

    processor.stoppedMainLoop = true;
    processor.run();

    Assert.assertTrue(
            "Request was not processed " + readReq + " instead "
                    + processedRequests.peek(),
            processedRequests.peek() != null
                    && processedRequests.peek().equals(readReq));
    processedRequests.poll();
    Assert.assertTrue(
            "Request was not processed " + writeReq + " instead "
                    + processedRequests.peek(),
            processedRequests.peek() != null
                    && processedRequests.peek().equals(writeReq));
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:37,代码来源:CommitProcessorConcurrencyTest.java

示例5: testInvalidPath

import org.apache.zookeeper.proto.SetDataRequest; //导入依赖的package包/类
/**
 * It tests that PrepRequestProcessor will return BadArgument KeeperException
 * if the request path (if it exists) is not valid, e.g. empty string.
 */
@Test
public void testInvalidPath() throws Exception {
    pLatch = new CountDownLatch(1);
    processor = new PrepRequestProcessor(zks, new MyRequestProcessor());

    SetDataRequest record = new SetDataRequest("", new byte[0], -1);
    Request req = createRequest(record, OpCode.setData);
    processor.pRequest(req);
    pLatch.await();
    Assert.assertEquals(outcome.getHdr().getType(), OpCode.error);
    Assert.assertEquals(outcome.getException().code(), KeeperException.Code.BADARGUMENTS);
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:17,代码来源:PrepRequestProcessorTest.java

示例6: checkType

import org.apache.zookeeper.proto.SetDataRequest; //导入依赖的package包/类
private EventType checkType(Record response) {

        if (response == null) {
            return EventType.other;
        } else if (response instanceof ConnectRequest) {
            return EventType.write;
        } else if (response instanceof CreateRequest) {
            return EventType.write;
        } else if (response instanceof DeleteRequest) {
            return EventType.write;
        } else if (response instanceof SetDataRequest) {
            return EventType.write;
        } else if (response instanceof SetACLRequest) {
            return EventType.write;
        } else if (response instanceof SetMaxChildrenRequest) {
            return EventType.write;
        } else if (response instanceof SetSASLRequest) {
            return EventType.write;
        } else if (response instanceof SetWatches) {
            return EventType.write;
        } else if (response instanceof SyncRequest) {
            return EventType.write;
        } else if (response instanceof ExistsRequest) {
            return EventType.read;
        } else if (response instanceof GetDataRequest) {
            return EventType.read;
        } else if (response instanceof GetMaxChildrenRequest) {
            return EventType.read;
        } else if (response instanceof GetACLRequest) {
            return EventType.read;
        } else if (response instanceof GetChildrenRequest) {
            return EventType.read;
        } else if (response instanceof GetChildren2Request) {
            return EventType.read;
        } else if (response instanceof GetSASLRequest) {
            return EventType.read;
        } else {
            return EventType.other;
        }
    }
 
开发者ID:apache,项目名称:incubator-pulsar,代码行数:41,代码来源:ClientCnxnAspect.java

示例7: toRequestRecord

import org.apache.zookeeper.proto.SetDataRequest; //导入依赖的package包/类
@Override
public Record toRequestRecord() {
    return new SetDataRequest(getPath(), data, version);
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:5,代码来源:Op.java

示例8: testJuteToString

import org.apache.zookeeper.proto.SetDataRequest; //导入依赖的package包/类
/** Verify jute - which we've had particular problems with in the past 
 * wrt null fields */
@Test
public void testJuteToString() {
    SetDataRequest req = new SetDataRequest(null, null, 0);
    Assert.assertNotSame("ERROR", req.toString());
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:8,代码来源:ToStringTest.java


注:本文中的org.apache.zookeeper.proto.SetDataRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。