org.apache.helix.model.Message.getPartitionName()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.apache.helix.model.Message.getPartitionName()方法的一些代码示例,展示了Message.getPartitionName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getPartitionName()方法的具体详情如下:
包路径:org.apache.helix.model.Message
类名称:Message
方法名:getPartitionName

Message.getPartitionName介绍

[英]Get the resource partition associated with this message
[中]获取与此消息关联的资源分区

代码示例

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "ERROR", to = "OFFLINE")
  2. public void onBecomeOfflineFromError(Message message, NotificationContext context) {
  3. LOGGER.info("Resetting the state for broker resource:{} from ERROR to OFFLINE", message.getPartitionName());
  4. }
  5. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "ERROR", to = "OFFLINE")
  2. public void onBecomeOfflineFromError(Message message, NotificationContext context) {
  3. _logger.info("Resetting the state for segment:{} from ERROR to OFFLINE", message.getPartitionName());
  4. }
  5. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "OFFLINE", to = "CONSUMING")
  2. public void onBecomeConsumingFromOffline(Message message, NotificationContext context) {
  3. Preconditions.checkState(SegmentName.isLowLevelConsumerSegmentName(message.getPartitionName()),
  4. "Tried to go into CONSUMING state on non-low level segment");
  5. _logger.info("SegmentOnlineOfflineStateModel.onBecomeConsumingFromOffline() : " + message);
  6. // We do the same processing as usual for going to the consuming state, which adds the segment to the table data
  7. // manager and starts Kafka consumption
  8. onBecomeOnlineFromOffline(message, context);
  9. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "ONLINE", to = "DROPPED")
  2. public void onBecomeDroppedFromOnline(Message message, NotificationContext context) {
  3. try {
  4. LOGGER.info("BrokerResourceOnlineOfflineStateModel.onBecomeDroppedFromOnline() : " + message);
  5. String tableName = message.getPartitionName();
  6. _helixExternalViewBasedRouting.markDataResourceOffline(tableName);
  7. _tableQueryQuotaManager.dropTableQueryQuota(tableName);
  8. } catch (Exception e) {
  9. LOGGER.error("Caught exception during ONLINE -> DROPPED transition", e);
  10. Utils.rethrowException(e);
  11. throw new AssertionError("Should not reach this");
  12. }
  13. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "ONLINE", to = "OFFLINE")
  2. public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
  3. try {
  4. LOGGER.info("BrokerResourceOnlineOfflineStateModel.onBecomeOfflineFromOnline() : " + message);
  5. String tableName = message.getPartitionName();
  6. _helixExternalViewBasedRouting.markDataResourceOffline(tableName);
  7. _tableQueryQuotaManager.dropTableQueryQuota(tableName);
  8. } catch (Exception e) {
  9. LOGGER.error("Caught exception during ONLINE -> OFFLINE transition", e);
  10. Utils.rethrowException(e);
  11. throw new AssertionError("Should not reach this");
  12. }
  13. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "OFFLINE", to = "DROPPED")
  2. public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
  3. try {
  4. LOGGER.info("BrokerResourceOnlineOfflineStateModel.onBecomeDroppedFromOffline() : " + message);
  5. String tableName = message.getPartitionName();
  6. _helixExternalViewBasedRouting.markDataResourceOffline(tableName);
  7. _tableQueryQuotaManager.dropTableQueryQuota(tableName);
  8. } catch (Exception e) {
  9. LOGGER.error("Caught exception during OFFLINE -> DROPPED transition", e);
  10. Utils.rethrowException(e);
  11. throw new AssertionError("Should not reach this");
  12. }
  13. }

代码示例来源:origin: apache/incubator-pinot

  1. @Override
  2. public MessageHandler createHandler(Message message, NotificationContext context) {
  3. String msgSubType = message.getMsgSubType();
  4. switch (msgSubType) {
  5. case TimeboundaryRefreshMessage.REFRESH_TIME_BOUNDARY_MSG_SUB_TYPE:
  6. LOGGER.info("time refresh msg received {} for table {}", message.getPartitionName());
  7. return new TimeboundaryRefreshMessageHandler(new TimeboundaryRefreshMessage(message), context);
  8. default:
  9. throw new UnsupportedOperationException("Unsupported user defined message sub type: " + msgSubType);
  10. }
  11. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "OFFLINE", to = "DROPPED")
  2. public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
  3. _logger.info("SegmentOnlineOfflineStateModel.onBecomeDroppedFromOffline() : " + message);
  4. String tableNameWithType = message.getResourceName();
  5. String segmentName = message.getPartitionName();
  6. // This method might modify the file on disk. Use segment lock to prevent race condition
  7. Lock segmentLock = SegmentLocks.getSegmentLock(tableNameWithType, segmentName);
  8. try {
  9. segmentLock.lock();
  10. final File segmentDir = new File(_fetcherAndLoader.getSegmentLocalDirectory(tableNameWithType, segmentName));
  11. if (segmentDir.exists()) {
  12. FileUtils.deleteQuietly(segmentDir);
  13. _logger.info("Deleted segment directory {}", segmentDir);
  14. }
  15. } catch (final Exception e) {
  16. _logger.error("Cannot delete the segment : " + segmentName + " from local directory!\n" + e.getMessage(), e);
  17. Utils.rethrowException(e);
  18. } finally {
  19. segmentLock.unlock();
  20. }
  21. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "ONLINE", to = "OFFLINE")
  2. public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
  3. _logger.info("SegmentOnlineOfflineStateModel.onBecomeOfflineFromOnline() : " + message);
  4. String tableNameWithType = message.getResourceName();
  5. String segmentName = message.getPartitionName();
  6. try {
  7. _instanceDataManager.removeSegment(tableNameWithType, segmentName);
  8. } catch (Exception e) {
  9. _logger.error("Caught exception in state transition from ONLINE -> OFFLINE for resource: {}, partition: {}",
  10. tableNameWithType, segmentName, e);
  11. Utils.rethrowException(e);
  12. }
  13. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "CONSUMING", to = "OFFLINE")
  2. public void onBecomeOfflineFromConsuming(Message message, NotificationContext context) {
  3. _logger.info("SegmentOnlineOfflineStateModel.onBecomeOfflineFromConsuming() : " + message);
  4. String realtimeTableName = message.getResourceName();
  5. String segmentName = message.getPartitionName();
  6. try {
  7. _instanceDataManager.removeSegment(realtimeTableName, segmentName);
  8. } catch (Exception e) {
  9. _logger.error("Caught exception in state transition from CONSUMING -> OFFLINE for resource: {}, partition: {}",
  10. realtimeTableName, segmentName, e);
  11. Utils.rethrowException(e);
  12. }
  13. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "OFFLINE", to = "CONSUMING")
  2. public void onBecomeConsumingFromOffline(Message message, NotificationContext context) {
  3. _currentSegment = message.getPartitionName();
  4. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "OFFLINE", to = "ONLINE")
  2. public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
  3. _logger.info("SegmentOnlineOfflineStateModel.onBecomeOnlineFromOffline() : " + message);
  4. String tableNameWithType = message.getResourceName();
  5. String segmentName = message.getPartitionName();
  6. try {
  7. TableType tableType = TableNameBuilder.getTableTypeFromTableName(message.getResourceName());
  8. Preconditions.checkNotNull(tableType);
  9. if (tableType == TableType.OFFLINE) {
  10. _fetcherAndLoader.addOrReplaceOfflineSegment(tableNameWithType, segmentName);
  11. } else {
  12. _instanceDataManager.addRealtimeSegment(tableNameWithType, segmentName);
  13. }
  14. } catch (Exception e) {
  15. _logger.error("Caught exception in state transition from OFFLINE -> ONLINE for resource: {}, partition: {}",
  16. tableNameWithType, segmentName, e);
  17. Utils.rethrowException(e);
  18. }
  19. }

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "CONSUMING", to = "ONLINE")
  2. public void onBecomeOnlineFromConsuming(Message message, NotificationContext context) {
  3. String realtimeTableName = message.getResourceName();
  4. String segmentNameStr = message.getPartitionName();
  5. LLCSegmentName segmentName = new LLCSegmentName(segmentNameStr);

代码示例来源:origin: apache/incubator-pinot

  1. @Transition(from = "OFFLINE", to = "ONLINE")
  2. public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
  3. try {
  4. LOGGER.info("BrokerResourceOnlineOfflineStateModel.onBecomeOnlineFromOffline() : " + message);
  5. Builder keyBuilder = _helixManager.getHelixDataAccessor().keyBuilder();
  6. String tableName = message.getPartitionName();
  7. HelixDataAccessor helixDataAccessor = _helixManager.getHelixDataAccessor();
  8. List<InstanceConfig> instanceConfigList = helixDataAccessor.getChildValues(keyBuilder.instanceConfigs());
  9. TableConfig tableConfig = ZKMetadataProvider.getTableConfig(_propertyStore, tableName);
  10. _helixExternalViewBasedRouting.markDataResourceOnline(tableConfig,
  11. HelixHelper.getExternalViewForResource(_helixAdmin, _helixManager.getClusterName(), tableName),
  12. instanceConfigList);
  13. _tableQueryQuotaManager.initTableQueryQuota(tableConfig, HelixHelper
  14. .getExternalViewForResource(_helixAdmin, _helixManager.getClusterName(), BROKER_RESOURCE_INSTANCE));
  15. } catch (Exception e) {
  16. LOGGER.error("Caught exception during OFFLINE -> ONLINE transition", e);
  17. Utils.rethrowException(e);
  18. throw new AssertionError("Should not reach this");
  19. }
  20. }

代码示例来源:origin: uber/chaperone

  1. public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
  2. System.out.println("TestOnlineOfflineStateModel.onBecomeDroppedFromOffline() for topic: "
  3. + message.getResourceName() + ", partition: " + message.getPartitionName()
  4. + " to instance: " + _instanceId);
  5. sleep();
  6. }

代码示例来源:origin: uber/chaperone

  1. public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
  2. System.out.println("TestOnlineOfflineStateModel.onBecomeOnlineFromOffline for topic: "
  3. + message.getResourceName() + ", partition: " + message.getPartitionName()
  4. + " to instance: " + _instanceId);
  5. sleep();
  6. }

代码示例来源:origin: uber/chaperone

  1. public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
  2. System.out.println("TestOnlineOfflineStateModel.onBecomeOfflineFromOnline for topic: "
  3. + message.getResourceName() + ", partition: " + message.getPartitionName()
  4. + " to instance: " + _instanceId);
  5. sleep();
  6. }

代码示例来源:origin: uber/uReplicator

  1. @Transition(from = "ONLINE", to = "OFFLINE")
  2. public void onBecomeOfflineFromOnline(Message message, NotificationContext context) {
  3. LOGGER.info("ControllerStateModel.onBecomeOfflineFromOnline() for resource: "
  4. + message.getResourceName() + ", partition: " + message.getPartitionName());
  5. handleStateChange(message);
  6. }

代码示例来源:origin: uber/uReplicator

  1. @Transition(from = "ERROR", to = "DROPPED")
  2. public void onBecomeDroppedFromError(Message message, NotificationContext context) {
  3. LOGGER.info("ControllerStateModel.onBecomeDroppedFromError() for resource: "
  4. + message.getResourceName() + ", partition: " + message.getPartitionName());
  5. handleStateChange(message);
  6. }

代码示例来源:origin: uber/uReplicator

  1. @Transition(from = "OFFLINE", to = "DROPPED")
  2. public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
  3. LOGGER.info("ControllerStateModel.onBecomeDroppedFromOffline() for resource: "
  4. + message.getResourceName() + ", partition: " + message.getPartitionName());
  5. handleStateChange(message);
  6. }

相关文章