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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

@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);
  _tableQueryQuotaManager.dropTableQueryQuota(tableName);
 } catch (Exception e) {
  LOGGER.error("Caught exception during OFFLINE -> DROPPED transition", e);
  Utils.rethrowException(e);
  throw new AssertionError("Should not reach this");
 }
}

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

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

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

@Transition(from = "OFFLINE", to = "DROPPED")
public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
 _logger.info("SegmentOnlineOfflineStateModel.onBecomeDroppedFromOffline() : " + message);
 String tableNameWithType = message.getResourceName();
 String segmentName = message.getPartitionName();
 // This method might modify the file on disk. Use segment lock to prevent race condition
 Lock segmentLock = SegmentLocks.getSegmentLock(tableNameWithType, segmentName);
 try {
  segmentLock.lock();
  final File segmentDir = new File(_fetcherAndLoader.getSegmentLocalDirectory(tableNameWithType, segmentName));
  if (segmentDir.exists()) {
   FileUtils.deleteQuietly(segmentDir);
   _logger.info("Deleted segment directory {}", segmentDir);
  }
 } catch (final Exception e) {
  _logger.error("Cannot delete the segment : " + segmentName + " from local directory!\n" + e.getMessage(), e);
  Utils.rethrowException(e);
 } finally {
  segmentLock.unlock();
 }
}

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

@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);
 }
}

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

@Transition(from = "CONSUMING", to = "OFFLINE")
public void onBecomeOfflineFromConsuming(Message message, NotificationContext context) {
 _logger.info("SegmentOnlineOfflineStateModel.onBecomeOfflineFromConsuming() : " + message);
 String realtimeTableName = message.getResourceName();
 String segmentName = message.getPartitionName();
 try {
  _instanceDataManager.removeSegment(realtimeTableName, segmentName);
 } catch (Exception e) {
  _logger.error("Caught exception in state transition from CONSUMING -> OFFLINE for resource: {}, partition: {}",
    realtimeTableName, segmentName, e);
  Utils.rethrowException(e);
 }
}

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

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

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

@Transition(from = "OFFLINE", to = "ONLINE")
public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
 _logger.info("SegmentOnlineOfflineStateModel.onBecomeOnlineFromOffline() : " + message);
 String tableNameWithType = message.getResourceName();
 String segmentName = message.getPartitionName();
 try {
  TableType tableType = TableNameBuilder.getTableTypeFromTableName(message.getResourceName());
  Preconditions.checkNotNull(tableType);
  if (tableType == TableType.OFFLINE) {
   _fetcherAndLoader.addOrReplaceOfflineSegment(tableNameWithType, segmentName);
  } else {
   _instanceDataManager.addRealtimeSegment(tableNameWithType, segmentName);
  }
 } catch (Exception e) {
  _logger.error("Caught exception in state transition from OFFLINE -> ONLINE for resource: {}, partition: {}",
    tableNameWithType, segmentName, e);
  Utils.rethrowException(e);
 }
}

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

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

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

@Transition(from = "OFFLINE", to = "ONLINE")
public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
 try {
  LOGGER.info("BrokerResourceOnlineOfflineStateModel.onBecomeOnlineFromOffline() : " + message);
  Builder keyBuilder = _helixManager.getHelixDataAccessor().keyBuilder();
  String tableName = message.getPartitionName();
  HelixDataAccessor helixDataAccessor = _helixManager.getHelixDataAccessor();
  List<InstanceConfig> instanceConfigList = helixDataAccessor.getChildValues(keyBuilder.instanceConfigs());
  TableConfig tableConfig = ZKMetadataProvider.getTableConfig(_propertyStore, tableName);
  _helixExternalViewBasedRouting.markDataResourceOnline(tableConfig,
    HelixHelper.getExternalViewForResource(_helixAdmin, _helixManager.getClusterName(), tableName),
    instanceConfigList);
  _tableQueryQuotaManager.initTableQueryQuota(tableConfig, HelixHelper
    .getExternalViewForResource(_helixAdmin, _helixManager.getClusterName(), BROKER_RESOURCE_INSTANCE));
 } catch (Exception e) {
  LOGGER.error("Caught exception during OFFLINE -> ONLINE transition", e);
  Utils.rethrowException(e);
  throw new AssertionError("Should not reach this");
 }
}

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

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

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

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

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

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

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

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

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

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

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

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

相关文章