本文整理汇总了Java中org.apache.helix.model.Message.getTgtSessionId方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getTgtSessionId方法的具体用法?Java Message.getTgtSessionId怎么用?Java Message.getTgtSessionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.model.Message
的用法示例。
在下文中一共展示了Message.getTgtSessionId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStatusUpdateRecordName
import org.apache.helix.model.Message; //导入方法依赖的package包/类
String getStatusUpdateRecordName(Message message) {
if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.name())) {
return message.getTgtSessionId() + "__" + message.getResourceName();
}
return message.getMsgId();
}
示例2: startTask
import org.apache.helix.model.Message; //导入方法依赖的package包/类
private void startTask(Message msg, String taskPartition) {
JobConfig cfg = TaskUtil.getJobConfig(_manager, msg.getResourceName());
TaskConfig taskConfig = null;
String command = cfg.getCommand();
// Get a task-specific command if specified
JobContext ctx = TaskUtil.getJobContext(_manager, msg.getResourceName());
int pId = Integer.parseInt(taskPartition.substring(taskPartition.lastIndexOf('_') + 1));
if (ctx.getTaskIdForPartition(pId) != null) {
taskConfig = cfg.getTaskConfig(ctx.getTaskIdForPartition(pId));
if (taskConfig != null) {
if (taskConfig.getCommand() != null) {
command = taskConfig.getCommand();
}
}
}
// Report a target if that was used to assign the partition
String target = ctx.getTargetForPartition(pId);
if (taskConfig == null && target != null) {
taskConfig = TaskConfig.Builder.from(target);
}
// Populate a task callback context
TaskCallbackContext callbackContext = new TaskCallbackContext();
callbackContext.setManager(_manager);
callbackContext.setJobConfig(cfg);
callbackContext.setTaskConfig(taskConfig);
// Create a task instance with this command
if (command == null || _taskFactoryRegistry == null
|| !_taskFactoryRegistry.containsKey(command)) {
throw new IllegalStateException("No callback implemented(or not registered) for task " + command);
}
TaskFactory taskFactory = _taskFactoryRegistry.get(command);
Task task = taskFactory.createNewTask(callbackContext);
if (task instanceof UserContentStore) {
((UserContentStore) task).init(_manager, cfg.getWorkflow(), msg.getResourceName(), taskPartition);
}
// Submit the task for execution
_taskRunner =
new TaskRunner(task, msg.getResourceName(), taskPartition, msg.getTgtName(), _manager,
msg.getTgtSessionId());
_taskExecutor.submit(_taskRunner);
_taskRunner.waitTillStarted();
// Set up a timer to cancel the task when its time out expires.
timeout_task = _timeoutTaskExecutor.schedule(new TimerTask() {
@Override
public void run() {
if (_taskRunner != null) {
_taskRunner.timeout();
}
}
}, cfg.getTimeoutPerTask(), TimeUnit.MILLISECONDS);
}