本文整理匯總了Java中org.apache.zookeeper.data.Stat.getAversion方法的典型用法代碼示例。如果您正苦於以下問題:Java Stat.getAversion方法的具體用法?Java Stat.getAversion怎麽用?Java Stat.getAversion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.zookeeper.data.Stat
的用法示例。
在下文中一共展示了Stat.getAversion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: modelModifiedExternally
import org.apache.zookeeper.data.Stat; //導入方法依賴的package包/類
@Override
protected void modelModifiedExternally() {
ZnodeModel znodeModel = getModel();
if (znodeModel.isDestroyed()) {
return;
}
ZnodeModelFormEditor editor = (ZnodeModelFormEditor) getEditor();
Znode znode = znodeModel.getData();
Stat stat = znode.getStat();
if (!isDirty() || stat.getAversion() == editor.getLastModificationAversion()) {
initFromModel();
}
else {
editor.setActivePage(ID);
setInfoText(EXTERNAL_MODIFICATION_INFO_TEXT);
}
}
示例2: setZNode
import org.apache.zookeeper.data.Stat; //導入方法依賴的package包/類
@PUT
@Produces( { MediaType.APPLICATION_JSON, "application/javascript",
MediaType.APPLICATION_XML })
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
public Response setZNode(
@PathParam("path") String path,
@QueryParam("callback") String callback,
@DefaultValue("-1") @QueryParam("version") String versionParam,
@DefaultValue("base64") @QueryParam("dataformat") String dataformat,
@DefaultValue("false") @QueryParam("null") String setNull,
@Context UriInfo ui, byte[] data) throws InterruptedException,
KeeperException {
ensurePathNotNull(path);
int version;
try {
version = Integer.parseInt(versionParam);
} catch (NumberFormatException e) {
throw new WebApplicationException(Response.status(
Response.Status.BAD_REQUEST).entity(
new ZError(ui.getRequestUri().toString(), path
+ " bad version " + versionParam)).build());
}
if (setNull.equals("true")) {
data = null;
}
Stat stat = zk.setData(path, data, version);
ZStat zstat = new ZStat(path, ui.getAbsolutePath().toString(), null,
null, stat.getCzxid(), stat.getMzxid(), stat.getCtime(), stat
.getMtime(), stat.getVersion(), stat.getCversion(),
stat.getAversion(), stat.getEphemeralOwner(), stat
.getDataLength(), stat.getNumChildren(), stat
.getPzxid());
return Response.status(Response.Status.OK).entity(
new JSONWithPadding(zstat, callback)).build();
}