当前位置: 首页>>代码示例>>Java>>正文


Java Message.getPartitionName方法代码示例

本文整理汇总了Java中org.apache.helix.model.Message.getPartitionName方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getPartitionName方法的具体用法?Java Message.getPartitionName怎么用?Java Message.getPartitionName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.helix.model.Message的用法示例。


在下文中一共展示了Message.getPartitionName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBecomeOnlineFromOffline

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(from = "OFFLINE", to = "ONLINE")
public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {

  try {
    LOGGER.info("BrokerResourceOnlineOfflineStateModel.onBecomeOnlineFromOffline() : " + message);
    Builder keyBuilder = _helixManager.getHelixDataAccessor().keyBuilder();
    String resourceName = message.getPartitionName();
    HelixDataAccessor helixDataAccessor = _helixManager.getHelixDataAccessor();
    List<InstanceConfig> instanceConfigList = helixDataAccessor.getChildValues(keyBuilder.instanceConfigs());

    _helixExternalViewBasedRouting.markDataResourceOnline(
        resourceName,
        HelixHelper.getExternalViewForResouce(_helixManager.getClusterManagmentTool(),
            _helixManager.getClusterName(), resourceName), instanceConfigList);
  } catch (Exception e) {
    LOGGER.error("Caught exception during OFFLINE -> ONLINE transition", e);
    Utils.rethrowException(e);
    throw new AssertionError("Should not reach this");
  }
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:21,代码来源:BrokerResourceOnlineOfflineStateModelFactory.java

示例2: onBecomeLeaderFromStandby

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "LEADER", from = "STANDBY")
public void onBecomeLeaderFromStandby(Message message, NotificationContext context)
    throws Exception {
  String clusterName = message.getPartitionName();
  String controllerName = message.getTgtName();

  logger.info(controllerName + " becomes leader from standby for " + clusterName);
  // System.out.println(controllerName + " becomes leader from standby for " + clusterName);

  if (_controller == null) {
    _controller =
        HelixManagerFactory.getZKHelixManager(clusterName, controllerName,
            InstanceType.CONTROLLER, _zkAddr);
    _controller.connect();
    _controller.startTimerTasks();
  } else {
    logger.error("controller already exists:" + _controller.getInstanceName() + " for "
        + clusterName);
  }

}
 
开发者ID:apache,项目名称:helix,代码行数:22,代码来源:DistClusterControllerStateModel.java

示例3: doTransition

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Override
public void doTransition(Message message, NotificationContext context) {
  MockParticipantManager manager = (MockParticipantManager) context.getManager();

  String instance = message.getTgtName();
  String partition = message.getPartitionName();
  if (instance.equals("localhost_12918") && partition.equals("TestDB0_1") // TestDB0_1 is SLAVE
                                                                          // on localhost_12918
      && _done.getAndSet(true) == false) {
    try {
      ZkTestHelper.expireSession(manager.getZkClient());
    } catch (Exception e) {
      LOG.error("Exception expire zk-session", e);
    }
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:17,代码来源:TestSessionExpiryInTransition.java

示例4: onBecomeStoppedFromRunning

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "STOPPED", from = "RUNNING")
public String onBecomeStoppedFromRunning(Message msg, NotificationContext context) {
  String taskPartition = msg.getPartitionName();
  if (_taskRunner == null) {
    throw new IllegalStateException(String.format(
        "Invalid state transition. There is no running task for partition %s.", taskPartition));
  }

  _taskRunner.cancel();
  TaskResult r = _taskRunner.waitTillDone();
  LOG.info(String.format("Task %s completed with result %s.", msg.getPartitionName(), r));

  timeout_task.cancel(false);

  return r.getInfo();
}
 
开发者ID:apache,项目名称:helix,代码行数:17,代码来源:TaskStateModel.java

示例5: onBecomeTaskErrorFromRunning

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "TASK_ERROR", from = "RUNNING")
public String onBecomeTaskErrorFromRunning(Message msg, NotificationContext context) {
  String taskPartition = msg.getPartitionName();
  if (_taskRunner == null) {
    throw new IllegalStateException(String.format(
        "Invalid state transition. There is no running task for partition %s.", taskPartition));
  }

  TaskResult r = _taskRunner.waitTillDone();
  if (r.getStatus() != TaskResult.Status.ERROR && r.getStatus() != TaskResult.Status.FAILED) {
    throw new IllegalStateException(String.format(
        "Partition %s received a state transition to %s but the result status code is %s.",
        msg.getPartitionName(), msg.getToState(), r.getStatus()));
  }

  timeout_task.cancel(false);

  return r.getInfo();
}
 
开发者ID:apache,项目名称:helix,代码行数:20,代码来源:TaskStateModel.java

示例6: onBecomeTaskAbortedFromRunning

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "TASK_ABORTED", from = "RUNNING")
public String onBecomeTaskAbortedFromRunning(Message msg, NotificationContext context) {
  String taskPartition = msg.getPartitionName();
  if (_taskRunner == null) {
    throw new IllegalStateException(String.format(
        "Invalid state transition. There is no running task for partition %s.", taskPartition));
  }

  _taskRunner.cancel();
  TaskResult r = _taskRunner.waitTillDone();
  if (r.getStatus() != TaskResult.Status.FATAL_FAILED && r.getStatus() != TaskResult.Status.CANCELED) {
    throw new IllegalStateException(String.format(
        "Partition %s received a state transition to %s but the result status code is %s.",
        msg.getPartitionName(), msg.getToState(), r.getStatus()));
  }

  timeout_task.cancel(false);

  return r.getInfo();
}
 
开发者ID:apache,项目名称:helix,代码行数:21,代码来源:TaskStateModel.java

示例7: onBecomeOnlineFromOfflineForRealtimeSegment

import org.apache.helix.model.Message; //导入方法依赖的package包/类
private void onBecomeOnlineFromOfflineForRealtimeSegment(Message message, NotificationContext context)
    throws Exception {
  final String segmentId = message.getPartitionName();
  final String tableName = message.getResourceName();

  SegmentZKMetadata realtimeSegmentZKMetadata =
      ZKMetadataProvider.getRealtimeSegmentZKMetadata(propertyStore, tableName, segmentId);
  InstanceZKMetadata instanceZKMetadata = ZKMetadataProvider.getInstanceZKMetadata(propertyStore, _instanceId);
  AbstractTableConfig tableConfig = ZKMetadataProvider.getRealtimeTableConfig(propertyStore, tableName);
  ((InstanceDataManager) INSTANCE_DATA_MANAGER).addSegment(propertyStore, tableConfig, instanceZKMetadata,
      realtimeSegmentZKMetadata);
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:13,代码来源:SegmentOnlineOfflineStateModelFactory.java

示例8: onBecomeOfflineFromOnline

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(from = "ONLINE", to = "OFFLINE")
public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
  LOGGER.debug("SegmentOnlineOfflineStateModel.onBecomeOfflineFromOnline() : " + message);
  final String segmentId = message.getPartitionName();
  try {
    INSTANCE_DATA_MANAGER.removeSegment(segmentId);
  } catch (final Exception e) {
    LOGGER.error("Cannot unload the segment : " + segmentId + "!\n" + e.getMessage(), e);
    Utils.rethrowException(e);
  }
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:12,代码来源:SegmentOnlineOfflineStateModelFactory.java

示例9: onBecomeDroppedFromOffline

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(from = "OFFLINE", to = "DROPPED")
public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
  LOGGER.debug("SegmentOnlineOfflineStateModel.onBecomeDroppedFromOffline() : " + message);
  final String segmentId = message.getPartitionName();
  final String tableName = message.getResourceName();
  try {
    final File segmentDir = new File(getSegmentLocalDirectory(tableName, segmentId));
    if (segmentDir.exists()) {
      FileUtils.deleteQuietly(segmentDir);
    }
  } catch (final Exception e) {
    LOGGER.error("Cannot delete the segment : " + segmentId + " from local directory!\n" + e.getMessage(), e);
    Utils.rethrowException(e);
  }
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:16,代码来源:SegmentOnlineOfflineStateModelFactory.java

示例10: onBecomeOfflineFromOnline

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(from = "ONLINE", to = "OFFLINE")
public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
  _logger.info("SegmentOnlineOfflineStateModel.onBecomeOfflineFromOnline() : " + message);
  String tableNameWithType = message.getResourceName();
  String segmentName = message.getPartitionName();
  try {
    _instanceDataManager.removeSegment(tableNameWithType, segmentName);
  } catch (Exception e) {
    _logger.error("Caught exception in state transition from ONLINE -> OFFLINE for resource: {}, partition: {}",
        tableNameWithType, segmentName, e);
    Utils.rethrowException(e);
  }
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:14,代码来源:SegmentOnlineOfflineStateModelFactory.java

示例11: doTransition

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Override
public void doTransition(Message message, NotificationContext context) {
  HelixManager manager = context.getManager();
  String clusterName = manager.getClusterName();

  String instance = message.getTgtName();
  String partitionName = message.getPartitionName();
  String fromState = message.getFromState();
  String toState = message.getToState();
  if (instance.equals("localhost_12919") && partitionName.equals("TestDB0_0")) {
    if (fromState.equals("SLAVE") && toState.equals("OFFLINE")) {
      slaveToOfflineCnt++;

      try {
        String command =
            "--zkSvr " + ZK_ADDR + " --enablePartition true " + clusterName
                + " localhost_12919 TestDB0 TestDB0_0";

        ClusterSetup.processCommandLineArgs(command.split("\\s+"));
      } catch (Exception e) {
        LOG.error("Exception in cluster setup", e);
      }

    } else if (slaveToOfflineCnt > 0 && fromState.equals("OFFLINE") && toState.equals("SLAVE")) {
      offlineToSlave++;
    }
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:29,代码来源:TestEnablePartitionDuringDisable.java

示例12: onBecomeDroppedFromOffline

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(from = "OFFLINE", to = "DROPPED")
public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
  try {
    LOGGER.info("BrokerResourceOnlineOfflineStateModel.onBecomeDroppedFromOffline() : " + message);
    String tableName = message.getPartitionName();
    _helixExternalViewBasedRouting.markDataResourceOffline(tableName);
  } catch (Exception e) {
    LOGGER.error("Caught exception during OFFLINE -> DROPPED transition", e);
    Utils.rethrowException(e);
    throw new AssertionError("Should not reach this");
  }
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:13,代码来源:BrokerResourceOnlineOfflineStateModelFactory.java

示例13: onBecomeStandbyFromLeader

import org.apache.helix.model.Message; //导入方法依赖的package包/类
@Transition(to = "STANDBY", from = "LEADER")
public void onBecomeStandbyFromLeader(Message message, NotificationContext context) {
  String clusterName = message.getPartitionName();
  String controllerName = message.getTgtName();

  logger.info(controllerName + " becoming standby from leader for " + clusterName);

  if (_controller != null) {
    _controller.disconnect();
    _controller = null;
  } else {
    logger.error("No controller exists for " + clusterName);
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:15,代码来源:DistClusterControllerStateModel.java

示例14: getRecordIdForMessage

import org.apache.helix.model.Message; //导入方法依赖的package包/类
private String getRecordIdForMessage(Message message) {
  if (message.getMsgType().equals(MessageType.STATE_TRANSITION)) {
    return message.getPartitionName() + " Trans:" + message.getFromState().charAt(0) + "->"
        + message.getToState().charAt(0) + "  " + UUID.randomUUID().toString();
  } else {
    return message.getMsgType() + " " + UUID.randomUUID().toString();
  }
}
 
开发者ID:apache,项目名称:helix,代码行数:9,代码来源:StatusUpdateUtil.java

示例15: onBecomeSlaveFromOffline

import org.apache.helix.model.Message; //导入方法依赖的package包/类
public void onBecomeSlaveFromOffline(Message message, NotificationContext context) {
  String db = message.getPartitionName();
  String instanceName = context.getManager().getInstanceName();
  DummyProcess.sleep(_transDelay);

  logger.info("DummyStateModel.onBecomeSlaveFromOffline(), instance:" + instanceName + ", db:"
      + db);
}
 
开发者ID:apache,项目名称:helix,代码行数:9,代码来源:DummyProcess.java


注:本文中的org.apache.helix.model.Message.getPartitionName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。