Ejemplo n.º 1
0
 /**
  * After receiving a fault increment fault count of the statistics logs from its parent to the
  * root log to maintain correct fault hierarchy.
  *
  * @param parentIndexOfFault parent Index of the fault log
  */
 private void addFaultsToParents(int parentIndexOfFault) {
   while (parentIndexOfFault > PARENT_LEVEL_OF_ROOT) {
     StatisticsLog updatingLog = messageFlowLogs.get(parentIndexOfFault);
     updatingLog.incrementNoOfFaults();
     parentIndexOfFault = updatingLog.getParentLevel();
   }
 }
Ejemplo n.º 2
0
 /**
  * Opens respective mediator logs in case of a continuation call.
  *
  * @param messageId message uuid which corresponds to the continuation flow.
  * @param componentId component name
  */
 public void openLogForContinuation(String messageId, String componentId) {
   if (continuationStateMap.containsKey(messageId)) {
     ContinuationStateHolder continuationStateHolder = continuationStateMap.get(messageId);
     int continuationIndex = continuationStateHolder.getCallbackPoint();
     Integer componentIndex = null;
     while (continuationIndex > continuationStateHolder.getContinuationStackPosition()) {
       StatisticsLog statisticsLog = messageFlowLogs.get(continuationIndex);
       if (statisticsLog.getComponentId().equals(componentId)) {
         componentIndex = continuationIndex;
       }
       continuationIndex = statisticsLog.getParentLevel();
     }
     if (componentIndex != null) {
       openLogs.addFirst(componentIndex);
       messageFlowLogs.get(componentIndex).setIsOpenedByContinuation(true);
       continuationStateHolder.setContinuationStackPosition(componentIndex);
     } else {
       if (log.isDebugEnabled()) {
         log.error("No log found to match the continuation component Id:" + componentId);
       }
     }
   } else {
     if (log.isDebugEnabled()) {
       log.debug("No continuation information found in statistic trace for this message Id.");
     }
   }
 }
Ejemplo n.º 3
0
 /**
  * Updates parent logs from the specified element after an notification is received. It updates
  * all the ended parent logs from specified index.
  *
  * @param closedIndex child index in the messageFlowLogs Array List
  * @param endTime end time of the child
  */
 private void updateParentLogs(int closedIndex, Long endTime) {
   if (closedIndex > -1) {
     StatisticsLog updatingLog = messageFlowLogs.get(closedIndex);
     // if log is closed end time will be different than -1
     while (!(updatingLog.getEndTime() == -1)) {
       updatingLog.setEndTime(endTime);
       if (updatingLog.getParentLevel() == PARENT_LEVEL_OF_ROOT) {
         break;
       }
       updatingLog = messageFlowLogs.get(updatingLog.getParentLevel());
     }
     if (log.isDebugEnabled()) {
       log.debug("Log updating finished.");
     }
   }
 }
Ejemplo n.º 4
0
 private Integer getParentForClosedMsgFlow(int msgId) {
   Integer sameMsgIdLastLog = getParentFromMessageLogs(msgId);
   StatisticsLog lastLog = messageFlowLogs.get(sameMsgIdLastLog);
   while (lastLog.getParentMsgId() > DEFAULT_MSG_ID) {
     Integer parentIndex = getParentFromOpenLogs(lastLog.getParentMsgId());
     if (parentIndex != null) {
       return parentIndex;
     }
     lastLog = messageFlowLogs.get(lastLog.getParentLevel());
   }
   return getParentFromOpenLogs(DEFAULT_MSG_ID);
 }
Ejemplo n.º 5
0
 /**
  * Closes opened statistics log specified by the componentLevel.
  *
  * @param componentLevel index of the closing statistic log in messageFlowLogs
  * @param endTime endTime of the closing statistics log
  */
 private void closeStatisticLog(int componentLevel, Long endTime) {
   StatisticsLog currentLog = messageFlowLogs.get(componentLevel);
   if (log.isDebugEnabled()) {
     log.debug(
         "Closed statistic log of [ElementId"
             + currentLog.getComponentId()
             + "][MsgId"
             + currentLog.getParentMsgId());
   }
   currentLog.setEndTime(endTime);
   updateParentLogs(currentLog.getParentLevel(), endTime);
 }