本文整理了Java中org.apache.helix.model.Message.getKey()
方法的一些代码示例,展示了Message.getKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getKey()
方法的具体详情如下:
包路径:org.apache.helix.model.Message
类名称:Message
方法名:getKey
[英]Get the PropertyKey for this message
[中]获取此邮件的PropertyKey
代码示例来源:origin: apache/incubator-gobblin
@Override
public void run() {
HelixManager helixManager = _notificationContext.getManager();
HelixDataAccessor helixDataAccessor = helixManager.getHelixDataAccessor();
HelixProperty helixProperty = helixDataAccessor
.getProperty(_message.getKey(helixDataAccessor.keyBuilder(), helixManager.getInstanceName()));
// The absence of the shutdown message indicates it has been removed
if (helixProperty == null) {
eventBus.post(new ClusterManagerShutdownRequest());
}
}
}, 0, 1, TimeUnit.SECONDS);
代码示例来源:origin: apache/incubator-gobblin
@Override
public void run() {
HelixManager helixManager = _notificationContext.getManager();
HelixDataAccessor helixDataAccessor = helixManager.getHelixDataAccessor();
HelixProperty helixProperty = helixDataAccessor.getProperty(
_message.getKey(helixDataAccessor.keyBuilder(), helixManager.getInstanceName()));
// The absence of the shutdown message indicates it has been removed
if (helixProperty == null) {
GobblinTaskRunner.this.stop();
}
}
}, 0, 1, TimeUnit.SECONDS);
代码示例来源:origin: org.apache.helix/helix-core
private void updateMessageState(List<Message> readMsgs, HelixDataAccessor accessor,
String instanceName) {
Builder keyBuilder = accessor.keyBuilder();
List<PropertyKey> readMsgKeys = new ArrayList<>();
for (Message msg : readMsgs) {
readMsgKeys.add(msg.getKey(keyBuilder, instanceName));
_knownMessageIds.add(msg.getId());
}
accessor.setChildren(readMsgKeys, readMsgs);
}
代码示例来源:origin: apache/helix
private void updateMessageState(List<Message> readMsgs, HelixDataAccessor accessor,
String instanceName) {
Builder keyBuilder = accessor.keyBuilder();
List<PropertyKey> readMsgKeys = new ArrayList<>();
for (Message msg : readMsgs) {
readMsgKeys.add(msg.getKey(keyBuilder, instanceName));
_knownMessageIds.add(msg.getId());
}
accessor.setChildren(readMsgKeys, readMsgs);
}
代码示例来源:origin: apache/helix
@Override public Object call() {
for (Map.Entry<String, Map<String, Message>> entry : pendingMessagesToPurge.entrySet()) {
String instanceName = entry.getKey();
for (Message msg : entry.getValue().values()) {
if (accessor.removeProperty(msg.getKey(accessor.keyBuilder(), instanceName))) {
LogUtil.logInfo(logger, _eventId, String
.format("Deleted message %s from instance %s", msg.getMsgId(), instanceName));
}
}
}
return null;
}
});
代码示例来源:origin: org.apache.helix/helix-core
@Override
public Object call() {
for (Map.Entry<String, Map<String, Message>> entry : pendingMessagesToPurge.entrySet()) {
String instanceName = entry.getKey();
for (Message msg : entry.getValue().values()) {
if (accessor.removeProperty(msg.getKey(accessor.keyBuilder(), instanceName))) {
LogUtil.logInfo(logger, _eventId, String
.format("Deleted message %s from instance %s", msg.getMsgId(), instanceName));
}
}
}
return null;
}
});
代码示例来源:origin: org.apache.helix/helix-core
/**
* Remove the given message from ZK using the given accessor. This function will
* not throw exception
* @param accessor HelixDataAccessor
* @param msg message to remove
* @param instanceName name of the instance on which the message sits
* @return true if success else false
*/
public static boolean removeMessageFromZK(HelixDataAccessor accessor, Message msg,
String instanceName) {
try {
return accessor.removeProperty(msg.getKey(accessor.keyBuilder(), instanceName));
} catch (Exception e) {
LOG.error("Caught exception while removing message {}.", msg, e);
}
return false;
}
代码示例来源:origin: apache/helix
/**
* Remove the given message from ZK using the given accessor. This function will
* not throw exception
* @param accessor HelixDataAccessor
* @param msg message to remove
* @param instanceName name of the instance on which the message sits
* @return true if success else false
*/
public static boolean removeMessageFromZK(HelixDataAccessor accessor, Message msg,
String instanceName) {
try {
return accessor.removeProperty(msg.getKey(accessor.keyBuilder(), instanceName));
} catch (Exception e) {
LOG.error("Caught exception while removing message {}.", msg, e);
}
return false;
}
代码示例来源:origin: com.linkedin.gobblin/gobblin-cluster
@Override
public void run() {
HelixManager helixManager = _notificationContext.getManager();
HelixDataAccessor helixDataAccessor = helixManager.getHelixDataAccessor();
HelixProperty helixProperty = helixDataAccessor
.getProperty(_message.getKey(helixDataAccessor.keyBuilder(), helixManager.getInstanceName()));
// The absence of the shutdown message indicates it has been removed
if (helixProperty == null) {
eventBus.post(new ClusterManagerShutdownRequest());
}
}
}, 0, 1, TimeUnit.SECONDS);
代码示例来源:origin: org.apache.gobblin/gobblin-cluster
@Override
public void run() {
HelixManager helixManager = _notificationContext.getManager();
HelixDataAccessor helixDataAccessor = helixManager.getHelixDataAccessor();
HelixProperty helixProperty = helixDataAccessor
.getProperty(_message.getKey(helixDataAccessor.keyBuilder(), helixManager.getInstanceName()));
// The absence of the shutdown message indicates it has been removed
if (helixProperty == null) {
eventBus.post(new ClusterManagerShutdownRequest());
}
}
}, 0, 1, TimeUnit.SECONDS);
代码示例来源:origin: com.linkedin.gobblin/gobblin-cluster
@Override
public void run() {
HelixManager helixManager = _notificationContext.getManager();
HelixDataAccessor helixDataAccessor = helixManager.getHelixDataAccessor();
HelixProperty helixProperty = helixDataAccessor
.getProperty(_message.getKey(helixDataAccessor.keyBuilder(), helixManager.getInstanceName()));
// The absence of the shutdown message indicates it has been removed
if (helixProperty == null) {
GobblinTaskRunner.this.stop();
}
}
}, 0, 1, TimeUnit.SECONDS);
代码示例来源:origin: org.apache.gobblin/gobblin-cluster
@Override
public void run() {
HelixManager helixManager = _notificationContext.getManager();
HelixDataAccessor helixDataAccessor = helixManager.getHelixDataAccessor();
HelixProperty helixProperty = helixDataAccessor.getProperty(
_message.getKey(helixDataAccessor.keyBuilder(), helixManager.getInstanceName()));
// The absence of the shutdown message indicates it has been removed
if (helixProperty == null) {
GobblinTaskRunner.this.stop();
}
}
}, 0, 1, TimeUnit.SECONDS);
代码示例来源:origin: apache/helix
msg.setFromState("SLAVE");
msg.setToState("MASTER");
dataAccessor.setProperty(msg.getKey(keyBuilder, instanceName), msg);
msgList.add(msg);
dataAccessor.setProperty(msgList.get(2).getKey(keyBuilder, instanceName), msgList.get(2));
executor.onMessage(instanceName, Arrays.asList(msgList.get(2)), changeContext);
Thread.sleep(200);
代码示例来源:origin: apache/helix
dupMsg.getRecord().setListFields(sourceMsg.getRecord().getListFields());
dupMsg.getRecord().setMapFields(sourceMsg.getRecord().getMapFields());
accessor.setProperty(dupMsg.getKey(accessor.keyBuilder(), dupMsg.getTgtName()), dupMsg);
Thread.sleep(1000);
accessor.setProperty(dupMsg.getKey(accessor.keyBuilder(), dupMsg.getTgtName()), dupMsg);
Thread.sleep(1000);
messages = accessor.getChildNames(keyBuilder.messages("localhost_0"));
内容来源于网络,如有侵权,请联系作者删除!