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");
}
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;
}
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;
}
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);
}
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);
}
Aggregations