下面列出了怎么用org.apache.zookeeper.proto.DeleteRequest的API类实例代码及写法,或者点击链接到github查看源代码。
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;
}
}
private static void deleteNodeFailSilent(ZKWatcher zkw,
DeleteNodeFailSilent dnfs) throws KeeperException {
DeleteRequest delete = (DeleteRequest)toZooKeeperOp(zkw, dnfs).toRequestRecord();
try {
zkw.getRecoverableZooKeeper().delete(delete.getPath(), delete.getVersion());
} catch(KeeperException.NoNodeException nne) {
} catch(InterruptedException ie) {
zkw.interruptedException(ie);
}
}
@Override
public List<CuratorTransactionResult> forOperations(List<CuratorOp> operations) throws Exception
{
operations = Preconditions.checkNotNull(operations, "operations cannot be null");
Preconditions.checkArgument(!operations.isEmpty(), "operations list cannot be empty");
CuratorMultiTransactionRecord record = new CuratorMultiTransactionRecord();
for ( CuratorOp curatorOp : operations )
{
Schema schema = client.getSchemaSet().getSchema(curatorOp.getTypeAndPath().getForPath());
record.add(curatorOp.get(), curatorOp.getTypeAndPath().getType(), curatorOp.getTypeAndPath().getForPath());
if ( (curatorOp.get().getType() == ZooDefs.OpCode.create) || (curatorOp.get().getType() == ZooDefs.OpCode.createContainer) )
{
CreateRequest createRequest = (CreateRequest)curatorOp.get().toRequestRecord();
CreateMode createMode = CreateMode.fromFlag(createRequest.getFlags(), CreateMode.PERSISTENT);
schema.validateCreate(createMode, createRequest.getPath(), createRequest.getData(), createRequest.getAcl());
}
else if ( (curatorOp.get().getType() == ZooDefs.OpCode.delete) || (curatorOp.get().getType() == ZooDefs.OpCode.deleteContainer) )
{
DeleteRequest deleteRequest = (DeleteRequest)curatorOp.get().toRequestRecord();
schema.validateDelete(deleteRequest.getPath());
}
else if ( curatorOp.get().getType() == ZooDefs.OpCode.setData )
{
SetDataRequest setDataRequest = (SetDataRequest)curatorOp.get().toRequestRecord();
schema.validateGeneral(setDataRequest.getPath(), setDataRequest.getData(), null);
}
}
if ( backgrounding.inBackground() )
{
client.processBackgroundOperation(new OperationAndData<>(this, record, backgrounding.getCallback(), null, backgrounding.getContext(), null), null);
return null;
}
else
{
return forOperationsInForeground(record);
}
}