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

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

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

Message.getResourceName介绍

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

代码示例

代码示例来源: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 = "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: 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: apache/helix

private void removeMessageFromTaskAndFutureMap(Message message) {
 _knownMessageIds.remove(message.getId());
 String messageTarget = getMessageTarget(message.getResourceName(), message.getPartitionName());
 if (_messageTaskMap.containsKey(messageTarget)) {
  _messageTaskMap.remove(messageTarget);
 }
}

代码示例来源: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: apache/helix

/**
 * Generate the sub-path under STATUSUPDATE or ERROR path for a status update
 */
String getStatusUpdateSubPath(Message message) {
 if (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.name())) {
  return message.getResourceName();
 }
 return message.getMsgType();
}

代码示例来源: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);
}

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

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

代码示例来源:origin: org.apache.helix/helix-core

public void onBecomeStandbyFromOffline(Message message, NotificationContext context) {
 System.out.println("LeaderStandbyStateModel.onBecomeStandbyFromOffline():" + _instanceName
   + " transitioning from " + message.getFromState() + " to " + message.getToState()
   + " for " + message.getResourceName() + " " + message.getPartitionName());
 sleep();
}

代码示例来源:origin: org.apache.helix/helix-core

public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
 System.out.println(
   "OnlineOfflineStateModelFactory.onBecomeOnlineFromOffline():" + _instanceName
     + " transitioning from " + message.getFromState() + " to " + message.getToState()
     + " for " + message.getResourceName() + " " + message.getPartitionName());
 sleep();
}

代码示例来源:origin: org.apache.helix/helix-core

public void onBecomeDroppedFromOffline(Message message, NotificationContext context) {
 System.out.println(
   "OnlineOfflineStateModelFactory.onBecomeDroppedFromOffline():" + _instanceName
     + " transitioning from " + message.getFromState() + " to " + message.getToState()
     + " for " + message.getResourceName() + " " + message.getPartitionName());
 sleep();
}

代码示例来源:origin: apache/helix

public void onBecomeOfflineFromStandby(Message message, NotificationContext context) {
 System.out.println("LeaderStandbyStateModel.onBecomeOfflineFromStandby():" + _instanceName
   + " transitioning from " + message.getFromState() + " to " + message.getToState()
   + " for " + message.getResourceName() + " " + message.getPartitionName());
 sleep();
}

代码示例来源:origin: apache/helix

@Transition(to = "*", from = "*")
public void generalTransitionHandle(Message message, NotificationContext context)
  throws InterruptedException {
 LOG.info(String
   .format("Resource %s partition %s becomes %s from %s", message.getResourceName(),
     message.getPartitionName(), message.getToState(), message.getFromState()));
 if (_transition != null) {
  _transition.doTransition(message, context);
 }
}

代码示例来源:origin: apache/helix

public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
 String db = message.getPartitionName();
 String instanceName = context.getManager().getInstanceName();
 MockProcess.sleep(_transDelay);
 logger.info("MockStateModel.onBecomeOnlineFromOffline(), instance:" + instanceName + ", db:"
   + db);
 logger.info(
   "MockStateModel.onBecomeOnlineFromOffline(), resource " + message.getResourceName()
     + ", partition"
     + message.getPartitionName());
 verifyMessage(message);
}

相关文章