本文整理汇总了Java中org.apache.zookeeper.proto.MultiHeader.getDone方法的典型用法代码示例。如果您正苦于以下问题:Java MultiHeader.getDone方法的具体用法?Java MultiHeader.getDone怎么用?Java MultiHeader.getDone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zookeeper.proto.MultiHeader
的用法示例。
在下文中一共展示了MultiHeader.getDone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.apache.zookeeper.proto.MultiHeader; //导入方法依赖的package包/类
@Override
public void deserialize(InputArchive archive, String tag) throws IOException {
results = new ArrayList<OpResult>();
archive.startRecord(tag);
MultiHeader h = new MultiHeader();
h.deserialize(archive, tag);
while (!h.getDone()) {
switch (h.getType()) {
case ZooDefs.OpCode.create:
CreateResponse cr = new CreateResponse();
cr.deserialize(archive, tag);
results.add(new OpResult.CreateResult(cr.getPath()));
break;
case ZooDefs.OpCode.delete:
results.add(new OpResult.DeleteResult());
break;
case ZooDefs.OpCode.setData:
SetDataResponse sdr = new SetDataResponse();
sdr.deserialize(archive, tag);
results.add(new OpResult.SetDataResult(sdr.getStat()));
break;
case ZooDefs.OpCode.check:
results.add(new OpResult.CheckResult());
break;
case ZooDefs.OpCode.error:
//FIXME: need way to more cleanly serialize/deserialize exceptions
ErrorResponse er = new ErrorResponse();
er.deserialize(archive, tag);
results.add(new OpResult.ErrorResult(er.getErr()));
break;
default:
throw new IOException("Invalid type " + h.getType() + " in MultiResponse");
}
h.deserialize(archive, tag);
}
archive.endRecord(tag);
}
示例2: deserialize
import org.apache.zookeeper.proto.MultiHeader; //导入方法依赖的package包/类
@Override
public void deserialize(InputArchive archive, String tag) throws IOException {
results = new ArrayList<OpResult>();
archive.startRecord(tag);
MultiHeader h = new MultiHeader();
h.deserialize(archive, tag);
while (!h.getDone()) {
switch (h.getType()) {
case ZooDefs.OpCode.create:
CreateResponse cr = new CreateResponse();
cr.deserialize(archive, tag);
results.add(new OpResult.CreateResult(cr.getPath()));
break;
case ZooDefs.OpCode.create2:
Create2Response cr2 = new Create2Response();
cr2.deserialize(archive, tag);
results.add(new OpResult.CreateResult(cr2.getPath(), cr2.getStat()));
break;
case ZooDefs.OpCode.delete:
results.add(new OpResult.DeleteResult());
break;
case ZooDefs.OpCode.setData:
SetDataResponse sdr = new SetDataResponse();
sdr.deserialize(archive, tag);
results.add(new OpResult.SetDataResult(sdr.getStat()));
break;
case ZooDefs.OpCode.check:
results.add(new OpResult.CheckResult());
break;
case ZooDefs.OpCode.error:
//FIXME: need way to more cleanly serialize/deserialize exceptions
ErrorResponse er = new ErrorResponse();
er.deserialize(archive, tag);
results.add(new OpResult.ErrorResult(er.getErr()));
break;
default:
throw new IOException("Invalid type " + h.getType() + " in MultiResponse");
}
h.deserialize(archive, tag);
}
archive.endRecord(tag);
}