Search in sources :

Example 1 with ReplyHeader

use of org.apache.zookeeper_voltpatches.proto.ReplyHeader in project voltdb by VoltDB.

the class NIOServerCnxn method process.

/*
     * (non-Javadoc)
     *
     * @see org.apache.zookeeper.server.ServerCnxnIface#process(org.apache.zookeeper.proto.WatcherEvent)
     */
@Override
public synchronized void process(WatchedEvent event) {
    ReplyHeader h = new ReplyHeader(-1, -1L, 0);
    if (LOG.isTraceEnabled()) {
        ZooTrace.logTraceMessage(LOG, ZooTrace.EVENT_DELIVERY_TRACE_MASK, "Deliver event " + event + " to 0x" + Long.toHexString(this.sessionId) + " through " + this);
    }
    // Convert WatchedEvent to a type that can be sent over the wire
    WatcherEvent e = event.getWrapper();
    sendResponse(h, e, "notification");
}
Also used : ReplyHeader(org.apache.zookeeper_voltpatches.proto.ReplyHeader) WatcherEvent(org.apache.zookeeper_voltpatches.proto.WatcherEvent)

Example 2 with ReplyHeader

use of org.apache.zookeeper_voltpatches.proto.ReplyHeader in project voltdb by VoltDB.

the class ReplyHeader method compareTo.

public int compareTo(Object peer_) throws ClassCastException {
    if (!(peer_ instanceof ReplyHeader)) {
        throw new ClassCastException("Comparing different types of records.");
    }
    ReplyHeader peer = (ReplyHeader) peer_;
    int ret = 0;
    ret = (xid == peer.xid) ? 0 : ((xid < peer.xid) ? -1 : 1);
    if (ret != 0)
        return ret;
    ret = (zxid == peer.zxid) ? 0 : ((zxid < peer.zxid) ? -1 : 1);
    if (ret != 0)
        return ret;
    ret = (err == peer.err) ? 0 : ((err < peer.err) ? -1 : 1);
    if (ret != 0)
        return ret;
    return ret;
}
Also used : ReplyHeader(org.apache.zookeeper_voltpatches.proto.ReplyHeader)

Example 3 with ReplyHeader

use of org.apache.zookeeper_voltpatches.proto.ReplyHeader in project voltdb by VoltDB.

the class ReplyHeader method equals.

@Override
public boolean equals(Object peer_) {
    if (!(peer_ instanceof ReplyHeader)) {
        return false;
    }
    if (peer_ == this) {
        return true;
    }
    ReplyHeader peer = (ReplyHeader) peer_;
    boolean ret = false;
    ret = (xid == peer.xid);
    if (!ret)
        return ret;
    ret = (zxid == peer.zxid);
    if (!ret)
        return ret;
    ret = (err == peer.err);
    if (!ret)
        return ret;
    return ret;
}
Also used : ReplyHeader(org.apache.zookeeper_voltpatches.proto.ReplyHeader)

Example 4 with ReplyHeader

use of org.apache.zookeeper_voltpatches.proto.ReplyHeader in project voltdb by VoltDB.

the class ZooKeeper method getChildren.

/**
     * The Asynchronous version of getChildren. The request doesn't actually
     * until the asynchronous callback is called.
     *
     * @since 3.3.0
     *
     * @see #getChildren(String, Watcher, Stat)
     */
public void getChildren(final String path, Watcher watcher, Children2Callback cb, Object ctx) {
    verbotenThreadCheck();
    final String clientPath = path;
    PathUtils.validatePath(clientPath);
    // the watch contains the un-chroot path
    WatchRegistration wcb = null;
    if (watcher != null) {
        wcb = new ChildWatchRegistration(watcher, clientPath);
    }
    final String serverPath = prependChroot(clientPath);
    RequestHeader h = new RequestHeader();
    h.setType(ZooDefs.OpCode.getChildren2);
    GetChildren2Request request = new GetChildren2Request();
    request.setPath(serverPath);
    request.setWatch(watcher != null);
    GetChildren2Response response = new GetChildren2Response();
    cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, wcb);
}
Also used : GetChildren2Response(org.apache.zookeeper_voltpatches.proto.GetChildren2Response) ReplyHeader(org.apache.zookeeper_voltpatches.proto.ReplyHeader) GetChildren2Request(org.apache.zookeeper_voltpatches.proto.GetChildren2Request) RequestHeader(org.apache.zookeeper_voltpatches.proto.RequestHeader)

Example 5 with ReplyHeader

use of org.apache.zookeeper_voltpatches.proto.ReplyHeader in project voltdb by VoltDB.

the class ZooKeeper method create.

/**
     * The Asynchronous version of create. The request doesn't actually until
     * the asynchronous callback is called.
     *
     * @see #create(String, byte[], List, CreateMode)
     */
public void create(final String path, byte[] data, List<ACL> acl, CreateMode createMode, StringCallback cb, Object ctx) {
    verbotenThreadCheck();
    final String clientPath = path;
    PathUtils.validatePath(clientPath, createMode.isSequential());
    final String serverPath = prependChroot(clientPath);
    RequestHeader h = new RequestHeader();
    h.setType(ZooDefs.OpCode.create);
    CreateRequest request = new CreateRequest();
    CreateResponse response = new CreateResponse();
    ReplyHeader r = new ReplyHeader();
    request.setData(data);
    request.setFlags(createMode.toFlag());
    request.setPath(serverPath);
    request.setAcl(acl);
    cnxn.queuePacket(h, r, request, response, cb, clientPath, serverPath, ctx, null);
}
Also used : ReplyHeader(org.apache.zookeeper_voltpatches.proto.ReplyHeader) CreateRequest(org.apache.zookeeper_voltpatches.proto.CreateRequest) CreateResponse(org.apache.zookeeper_voltpatches.proto.CreateResponse) RequestHeader(org.apache.zookeeper_voltpatches.proto.RequestHeader)

Aggregations

ReplyHeader (org.apache.zookeeper_voltpatches.proto.ReplyHeader)25 RequestHeader (org.apache.zookeeper_voltpatches.proto.RequestHeader)20 SetDataResponse (org.apache.zookeeper_voltpatches.proto.SetDataResponse)5 CreateResponse (org.apache.zookeeper_voltpatches.proto.CreateResponse)3 ExistsRequest (org.apache.zookeeper_voltpatches.proto.ExistsRequest)3 GetACLRequest (org.apache.zookeeper_voltpatches.proto.GetACLRequest)3 GetACLResponse (org.apache.zookeeper_voltpatches.proto.GetACLResponse)3 GetChildren2Request (org.apache.zookeeper_voltpatches.proto.GetChildren2Request)3 GetChildren2Response (org.apache.zookeeper_voltpatches.proto.GetChildren2Response)3 GetChildrenRequest (org.apache.zookeeper_voltpatches.proto.GetChildrenRequest)3 GetChildrenResponse (org.apache.zookeeper_voltpatches.proto.GetChildrenResponse)3 GetDataRequest (org.apache.zookeeper_voltpatches.proto.GetDataRequest)3 GetDataResponse (org.apache.zookeeper_voltpatches.proto.GetDataResponse)3 SetACLResponse (org.apache.zookeeper_voltpatches.proto.SetACLResponse)3 AuthPacket (org.apache.zookeeper_voltpatches.proto.AuthPacket)2 CreateRequest (org.apache.zookeeper_voltpatches.proto.CreateRequest)2 DeleteRequest (org.apache.zookeeper_voltpatches.proto.DeleteRequest)2 SetACLRequest (org.apache.zookeeper_voltpatches.proto.SetACLRequest)2 SetDataRequest (org.apache.zookeeper_voltpatches.proto.SetDataRequest)2 SyncRequest (org.apache.zookeeper_voltpatches.proto.SyncRequest)2