/** Wraps the service statistics into JMX types */
 private void populateServiceStatistics(boolean clearCollectedStats) {
   // clear existing stats in the TabularDataSupport and re-populate it with current data extracted
   // from service framework classes
   serviceInvocationStatistics.clear();
   ServiceStatistics[] stats = getStats(clearCollectedStats);
   for (ServiceStatistics stat : stats) {
     Object[] statValues = new Object[attributeNames.length];
     statValues[0] = stat.getServiceName();
     statValues[1] = stat.getServiceVersion();
     statValues[2] = stat.getStartupTimeStamp().getTime();
     statValues[3] =
         stat.getLastCalledTimestamp() == null ? null : stat.getLastCalledTimestamp().getTime();
     statValues[4] = stat.getActiveRequestsCount();
     statValues[5] = stat.getTotalRequestsCount();
     statValues[6] = stat.getAverageResponseTime();
     statValues[7] = stat.getMinimumResponseTime();
     statValues[8] = stat.getMaximumResponseTime();
     statValues[9] = stat.getLastServiceRequestResponseTime();
     statValues[10] = stat.getErrorRequestsCount();
     statValues[11] = stat.getSuccessRequestsCount();
     CompositeData compositeData;
     try {
       compositeData = new CompositeDataSupport(compositeType, attributeNames, statValues);
       serviceInvocationStatistics.put(compositeData);
     } catch (OpenDataException e) {
       // ideally we should not get this exception
       LOGGER.error(
           "Error constructing JMX data type from service statistics. Error is : "
               + e.getMessage(),
           e);
     }
   }
 }
Exemplo n.º 2
0
 public CompositeData getCoordination(long id) throws IOException {
   Coordination c = getCoordinationById(id);
   if (c != null) {
     try {
       return fromCoordination((CoordinationImpl) c);
     } catch (OpenDataException e) {
       throw new IOException(e.toString());
     }
   }
   throw new IOException("No such Coordination " + id);
 }