本文整理汇总了Java中org.apache.zookeeper.ZooDefs.OpCode.createContainer方法的典型用法代码示例。如果您正苦于以下问题:Java OpCode.createContainer方法的具体用法?Java OpCode.createContainer怎么用?Java OpCode.createContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zookeeper.ZooDefs.OpCode
的用法示例。
在下文中一共展示了OpCode.createContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: needCommit
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
protected boolean needCommit(Request request) {
switch (request.type) {
case OpCode.create:
case OpCode.create2:
case OpCode.createTTL:
case OpCode.createContainer:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.setData:
case OpCode.reconfig:
case OpCode.multi:
case OpCode.setACL:
return true;
case OpCode.sync:
return matchSyncs;
case OpCode.createSession:
case OpCode.closeSession:
return !request.isLocalSession();
default:
return false;
}
}
示例2: needCommit
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
protected boolean needCommit(Request request) {
switch (request.type) {
case OpCode.create:
case OpCode.create2:
case OpCode.createContainer:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.setData:
case OpCode.reconfig:
case OpCode.multi:
case OpCode.setACL:
return true;
case OpCode.sync:
return matchSyncs;
case OpCode.createSession:
case OpCode.closeSession:
return !request.isLocalSession();
default:
return false;
}
}
示例3: isValid
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
/**
* is the packet type a valid packet in zookeeper
*
* @param type
* the type of the packet
* @return true if a valid packet, false if not
*/
static boolean isValid(int type) {
// make sure this is always synchronized with Zoodefs!!
switch (type) {
case OpCode.notification:
return false;
case OpCode.check:
case OpCode.closeSession:
case OpCode.create:
case OpCode.create2:
case OpCode.createTTL:
case OpCode.createContainer:
case OpCode.createSession:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.exists:
case OpCode.getACL:
case OpCode.getChildren:
case OpCode.getChildren2:
case OpCode.getData:
case OpCode.multi:
case OpCode.ping:
case OpCode.reconfig:
case OpCode.setACL:
case OpCode.setData:
case OpCode.setWatches:
case OpCode.sync:
case OpCode.checkWatches:
case OpCode.removeWatches:
return true;
default:
return false;
}
}
示例4: isQuorum
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
public boolean isQuorum() {
switch (this.type) {
case OpCode.exists:
case OpCode.getACL:
case OpCode.getChildren:
case OpCode.getChildren2:
case OpCode.getData:
return false;
case OpCode.create:
case OpCode.create2:
case OpCode.createTTL:
case OpCode.createContainer:
case OpCode.error:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.setACL:
case OpCode.setData:
case OpCode.check:
case OpCode.multi:
case OpCode.reconfig:
return true;
case OpCode.closeSession:
case OpCode.createSession:
return !this.isLocalSession;
default:
return false;
}
}
示例5: isValid
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
/**
* is the packet type a valid packet in zookeeper
*
* @param type
* the type of the packet
* @return true if a valid packet, false if not
*/
static boolean isValid(int type) {
// make sure this is always synchronized with Zoodefs!!
switch (type) {
case OpCode.notification:
return false;
case OpCode.check:
case OpCode.closeSession:
case OpCode.create:
case OpCode.create2:
case OpCode.createContainer:
case OpCode.createSession:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.exists:
case OpCode.getACL:
case OpCode.getChildren:
case OpCode.getChildren2:
case OpCode.getData:
case OpCode.multi:
case OpCode.ping:
case OpCode.reconfig:
case OpCode.setACL:
case OpCode.setData:
case OpCode.setWatches:
case OpCode.sync:
case OpCode.checkWatches:
case OpCode.removeWatches:
return true;
default:
return false;
}
}
示例6: isQuorum
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
public boolean isQuorum() {
switch (this.type) {
case OpCode.exists:
case OpCode.getACL:
case OpCode.getChildren:
case OpCode.getChildren2:
case OpCode.getData:
return false;
case OpCode.create:
case OpCode.create2:
case OpCode.createContainer:
case OpCode.error:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.setACL:
case OpCode.setData:
case OpCode.check:
case OpCode.multi:
case OpCode.reconfig:
return true;
case OpCode.closeSession:
case OpCode.createSession:
return !this.isLocalSession;
default:
return false;
}
}
示例7: run
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
@Override
public void run() {
try {
while (!finished) {
Request request = queuedRequests.take();
if (LOG.isTraceEnabled()) {
ZooTrace.logRequest(LOG, ZooTrace.CLIENT_REQUEST_TRACE_MASK,
'F', request, "");
}
if (request == Request.requestOfDeath) {
break;
}
// We want to queue the request to be processed before we submit
// the request to the leader so that we are ready to receive
// the response
nextProcessor.processRequest(request);
// We now ship the request to the leader. As with all
// other quorum operations, sync also follows this code
// path, but different from others, we need to keep track
// of the sync operations this follower has pending, so we
// add it to pendingSyncs.
switch (request.type) {
case OpCode.sync:
zks.pendingSyncs.add(request);
zks.getFollower().request(request);
break;
case OpCode.create:
case OpCode.create2:
case OpCode.createTTL:
case OpCode.createContainer:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.setData:
case OpCode.reconfig:
case OpCode.setACL:
case OpCode.multi:
case OpCode.check:
zks.getFollower().request(request);
break;
case OpCode.createSession:
case OpCode.closeSession:
// Don't forward local sessions to the leader.
if (!request.isLocalSession()) {
zks.getFollower().request(request);
}
break;
}
}
} catch (Exception e) {
handleException(this.getName(), e);
}
LOG.info("FollowerRequestProcessor exited loop!");
}
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:55,代码来源:FollowerRequestProcessor.java
示例8: run
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
@Override
public void run() {
try {
while (!finished) {
Request request = queuedRequests.take();
if (LOG.isTraceEnabled()) {
ZooTrace.logRequest(LOG, ZooTrace.CLIENT_REQUEST_TRACE_MASK,
'F', request, "");
}
if (request == Request.requestOfDeath) {
break;
}
// We want to queue the request to be processed before we submit
// the request to the leader so that we are ready to receive
// the response
nextProcessor.processRequest(request);
// We now ship the request to the leader. As with all
// other quorum operations, sync also follows this code
// path, but different from others, we need to keep track
// of the sync operations this Observer has pending, so we
// add it to pendingSyncs.
switch (request.type) {
case OpCode.sync:
zks.pendingSyncs.add(request);
zks.getObserver().request(request);
break;
case OpCode.create:
case OpCode.create2:
case OpCode.createTTL:
case OpCode.createContainer:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.setData:
case OpCode.reconfig:
case OpCode.setACL:
case OpCode.multi:
case OpCode.check:
zks.getObserver().request(request);
break;
case OpCode.createSession:
case OpCode.closeSession:
// Don't forward local sessions to the leader.
if (!request.isLocalSession()) {
zks.getObserver().request(request);
}
break;
}
}
} catch (Exception e) {
handleException(this.getName(), e);
}
LOG.info("ObserverRequestProcessor exited loop!");
}
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:55,代码来源:ObserverRequestProcessor.java
示例9: op2String
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
public static String op2String(int op) {
switch (op) {
case OpCode.notification:
return "notification";
case OpCode.create:
return "create";
case OpCode.create2:
return "create2";
case OpCode.createTTL:
return "createTtl";
case OpCode.createContainer:
return "createContainer";
case OpCode.delete:
return "delete";
case OpCode.deleteContainer:
return "deleteContainer";
case OpCode.exists:
return "exists";
case OpCode.getData:
return "getDate";
case OpCode.setData:
return "setData";
case OpCode.multi:
return "multi";
case OpCode.getACL:
return "getACL";
case OpCode.setACL:
return "setACL";
case OpCode.getChildren:
return "getChildren";
case OpCode.getChildren2:
return "getChildren2";
case OpCode.ping:
return "ping";
case OpCode.createSession:
return "createSession";
case OpCode.closeSession:
return "closeSession";
case OpCode.error:
return "error";
case OpCode.reconfig:
return "reconfig";
default:
return "unknown " + op;
}
}
示例10: pRequest2TxnCreate
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
private void pRequest2TxnCreate(int type, Request request, Record record, boolean deserialize) throws IOException, KeeperException {
if (deserialize) {
ByteBufferInputStream.byteBuffer2Record(request.request, record);
}
int flags;
String path;
List<ACL> acl;
byte[] data;
long ttl;
if (type == OpCode.createTTL) {
CreateTTLRequest createTtlRequest = (CreateTTLRequest)record;
flags = createTtlRequest.getFlags();
path = createTtlRequest.getPath();
acl = createTtlRequest.getAcl();
data = createTtlRequest.getData();
ttl = createTtlRequest.getTtl();
} else {
CreateRequest createRequest = (CreateRequest)record;
flags = createRequest.getFlags();
path = createRequest.getPath();
acl = createRequest.getAcl();
data = createRequest.getData();
ttl = -1;
}
CreateMode createMode = CreateMode.fromFlag(flags);
validateCreateRequest(path, createMode, request, ttl);
String parentPath = validatePathForCreate(path, request.sessionId);
List<ACL> listACL = fixupACL(path, request.authInfo, acl);
ChangeRecord parentRecord = getRecordForPath(parentPath);
checkACL(zks, request.cnxn, parentRecord.acl, ZooDefs.Perms.CREATE, request.authInfo, path, listACL);
int parentCVersion = parentRecord.stat.getCversion();
if (createMode.isSequential()) {
path = path + String.format(Locale.ENGLISH, "%010d", parentCVersion);
}
validatePath(path, request.sessionId);
try {
if (getRecordForPath(path) != null) {
throw new KeeperException.NodeExistsException(path);
}
} catch (KeeperException.NoNodeException e) {
// ignore this one
}
boolean ephemeralParent = EphemeralType.get(parentRecord.stat.getEphemeralOwner()) == EphemeralType.NORMAL;
if (ephemeralParent) {
throw new KeeperException.NoChildrenForEphemeralsException(path);
}
int newCversion = parentRecord.stat.getCversion()+1;
if (type == OpCode.createContainer) {
request.setTxn(new CreateContainerTxn(path, data, listACL, newCversion));
} else if (type == OpCode.createTTL) {
request.setTxn(new CreateTTLTxn(path, data, listACL, newCversion, ttl));
} else {
request.setTxn(new CreateTxn(path, data, listACL, createMode.isEphemeral(),
newCversion));
}
StatPersisted s = new StatPersisted();
if (createMode.isEphemeral()) {
s.setEphemeralOwner(request.sessionId);
}
parentRecord = parentRecord.duplicate(request.getHdr().getZxid());
parentRecord.childCount++;
parentRecord.stat.setCversion(newCversion);
addChangeRecord(parentRecord);
addChangeRecord(new ChangeRecord(request.getHdr().getZxid(), path, s, 0, listACL));
}
示例11: op2String
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
static String op2String(int op) {
switch (op) {
case OpCode.notification:
return "notification";
case OpCode.create:
return "create";
case OpCode.create2:
return "create2";
case OpCode.createTTL:
return "createTtl";
case OpCode.createContainer:
return "createContainer";
case OpCode.setWatches:
return "setWatches";
case OpCode.delete:
return "delete";
case OpCode.deleteContainer:
return "deleteContainer";
case OpCode.exists:
return "exists";
case OpCode.getData:
return "getData";
case OpCode.check:
return "check";
case OpCode.multi:
return "multi";
case OpCode.setData:
return "setData";
case OpCode.sync:
return "sync:";
case OpCode.getACL:
return "getACL";
case OpCode.setACL:
return "setACL";
case OpCode.getChildren:
return "getChildren";
case OpCode.getChildren2:
return "getChildren2";
case OpCode.ping:
return "ping";
case OpCode.createSession:
return "createSession";
case OpCode.closeSession:
return "closeSession";
case OpCode.error:
return "error";
case OpCode.reconfig:
return "reconfig";
case OpCode.checkWatches:
return "checkWatches";
case OpCode.removeWatches:
return "removeWatches";
default:
return "unknown " + op;
}
}
示例12: run
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
@Override
public void run() {
try {
while (!finished) {
Request request = queuedRequests.take();
if (LOG.isTraceEnabled()) {
ZooTrace.logRequest(LOG, ZooTrace.CLIENT_REQUEST_TRACE_MASK,
'F', request, "");
}
if (request == Request.requestOfDeath) {
break;
}
// We want to queue the request to be processed before we submit
// the request to the leader so that we are ready to receive
// the response
nextProcessor.processRequest(request);
// We now ship the request to the leader. As with all
// other quorum operations, sync also follows this code
// path, but different from others, we need to keep track
// of the sync operations this follower has pending, so we
// add it to pendingSyncs.
switch (request.type) {
case OpCode.sync:
zks.pendingSyncs.add(request);
zks.getFollower().request(request);
break;
case OpCode.create:
case OpCode.create2:
case OpCode.createContainer:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.setData:
case OpCode.reconfig:
case OpCode.setACL:
case OpCode.multi:
case OpCode.check:
zks.getFollower().request(request);
break;
case OpCode.createSession:
case OpCode.closeSession:
// Don't forward local sessions to the leader.
if (!request.isLocalSession()) {
zks.getFollower().request(request);
}
break;
}
}
} catch (Exception e) {
handleException(this.getName(), e);
}
LOG.info("FollowerRequestProcessor exited loop!");
}
示例13: run
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
@Override
public void run() {
try {
while (!finished) {
Request request = queuedRequests.take();
if (LOG.isTraceEnabled()) {
ZooTrace.logRequest(LOG, ZooTrace.CLIENT_REQUEST_TRACE_MASK,
'F', request, "");
}
if (request == Request.requestOfDeath) {
break;
}
// We want to queue the request to be processed before we submit
// the request to the leader so that we are ready to receive
// the response
nextProcessor.processRequest(request);
// We now ship the request to the leader. As with all
// other quorum operations, sync also follows this code
// path, but different from others, we need to keep track
// of the sync operations this Observer has pending, so we
// add it to pendingSyncs.
switch (request.type) {
case OpCode.sync:
zks.pendingSyncs.add(request);
zks.getObserver().request(request);
break;
case OpCode.create:
case OpCode.create2:
case OpCode.createContainer:
case OpCode.delete:
case OpCode.deleteContainer:
case OpCode.setData:
case OpCode.reconfig:
case OpCode.setACL:
case OpCode.multi:
case OpCode.check:
zks.getObserver().request(request);
break;
case OpCode.createSession:
case OpCode.closeSession:
// Don't forward local sessions to the leader.
if (!request.isLocalSession()) {
zks.getObserver().request(request);
}
break;
}
}
} catch (Exception e) {
handleException(this.getName(), e);
}
LOG.info("ObserverRequestProcessor exited loop!");
}
示例14: op2String
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
public static String op2String(int op) {
switch (op) {
case OpCode.notification:
return "notification";
case OpCode.create:
return "create";
case OpCode.create2:
return "create2";
case OpCode.createContainer:
return "createContainer";
case OpCode.delete:
return "delete";
case OpCode.deleteContainer:
return "deleteContainer";
case OpCode.exists:
return "exists";
case OpCode.getData:
return "getDate";
case OpCode.setData:
return "setData";
case OpCode.multi:
return "multi";
case OpCode.getACL:
return "getACL";
case OpCode.setACL:
return "setACL";
case OpCode.getChildren:
return "getChildren";
case OpCode.getChildren2:
return "getChildren2";
case OpCode.ping:
return "ping";
case OpCode.createSession:
return "createSession";
case OpCode.closeSession:
return "closeSession";
case OpCode.error:
return "error";
case OpCode.reconfig:
return "reconfig";
default:
return "unknown " + op;
}
}
示例15: op2String
import org.apache.zookeeper.ZooDefs.OpCode; //导入方法依赖的package包/类
static String op2String(int op) {
switch (op) {
case OpCode.notification:
return "notification";
case OpCode.create:
return "create";
case OpCode.create2:
return "create2";
case OpCode.createContainer:
return "createContainer";
case OpCode.setWatches:
return "setWatches";
case OpCode.delete:
return "delete";
case OpCode.deleteContainer:
return "deleteContainer";
case OpCode.exists:
return "exists";
case OpCode.getData:
return "getData";
case OpCode.check:
return "check";
case OpCode.multi:
return "multi";
case OpCode.setData:
return "setData";
case OpCode.sync:
return "sync:";
case OpCode.getACL:
return "getACL";
case OpCode.setACL:
return "setACL";
case OpCode.getChildren:
return "getChildren";
case OpCode.getChildren2:
return "getChildren2";
case OpCode.ping:
return "ping";
case OpCode.createSession:
return "createSession";
case OpCode.closeSession:
return "closeSession";
case OpCode.error:
return "error";
case OpCode.reconfig:
return "reconfig";
case OpCode.checkWatches:
return "checkWatches";
case OpCode.removeWatches:
return "removeWatches";
default:
return "unknown " + op;
}
}