Package org.infoglue.cms.util.sorters

Examples of org.infoglue.cms.util.sorters.AverageInvokingTimeComparator


          int componentNumberOfHits = RequestAnalyser.getComponentNumberOfHits(componentName);
          //states.add(getList("" + componentName + " - " + componentNumberOfHits + " hits", "" + componentAverageElapsedTime));
          unsortedComponents.add(getList("" + componentName + " - " + componentNumberOfHits + " hits - total " + (componentNumberOfHits * componentAverageElapsedTime), new Long(componentAverageElapsedTime)));
        }

        Collections.sort(unsortedComponents, new AverageInvokingTimeComparator());
       
      states.addAll(unsortedComponents);
     
        return "successComponentStatistics";
    }
View Full Code Here


          long pageAverageElapsedTime = RequestAnalyser.getPageAverageElapsedTime(pageUrl);
          int pageNumberOfHits = RequestAnalyser.getPageNumberOfHits(pageUrl);
          unsortedPageUrls.add(getList("" + pageUrl + " - " + pageNumberOfHits + " hits - total " + (pageNumberOfHits * pageAverageElapsedTime), new Long(pageAverageElapsedTime)));
        }

        Collections.sort(unsortedPageUrls, new AverageInvokingTimeComparator());
       
      states.addAll(unsortedPageUrls);

        return "successPageStatistics";
    }
View Full Code Here

                      long pageAverageElapsedTime = totalElapsedTime / pageNumberOfHits;
                      unsortedPageUrls.add(getList("" + pageUrl, new Long(pageAverageElapsedTime)));
                  }
                }
   
                Collections.sort(unsortedPageUrls, new AverageInvokingTimeComparator());
               
                if(unsortedPageUrls.size() > 50)
                  unsortedPageUrls = unsortedPageUrls.subList(0, 50);
               
                Iterator unsortedPageUrlsIterator = unsortedPageUrls.iterator();
                while(unsortedPageUrlsIterator.hasNext())
                {
                  List item = (List)unsortedPageUrlsIterator.next();
                  if(item.size() > 1)
                  {
                    String pageUrl = (String)item.get(0);
                    shortPageStatistics.put(pageUrl, allPageStatistics.get(pageUrl));
                  }
                }
               
                allPageStatistics = shortPageStatistics;
          }
        }
      }
      catch (Exception e)
      {
        logger.error("Error in shortenPageStatistics:" + e.getMessage());
    }
     
      try
      {
        logger.info("Shortening allComponentsStatistics: " + allComponentsStatistics.size());
        synchronized (allComponentsStatistics)
        {
          if(allComponentsStatistics.size() > 500)
          {
            Map shortComponentsStatistics = new HashMap();
   
                List unsortedComponentStatistics = new ArrayList();
                Set componentUrls = allComponentsStatistics.keySet();
                Iterator componentUrlsIterator = componentUrls.iterator();
                while(componentUrlsIterator.hasNext())
                {
                  String componentUrl = (String)componentUrlsIterator.next();
                  Map componentStatistics = (Map)allComponentsStatistics.get(componentUrl);
                  synchronized (componentStatistics)
                  {
                      Long totalElapsedTime = (Long)componentStatistics.get("totalElapsedTime");
                      Integer componentNumberOfHits = (Integer)componentStatistics.get("totalNumberOfInvokations");
                      long componentAverageElapsedTime = totalElapsedTime / componentNumberOfHits;
                      unsortedComponentStatistics.add(getList("" + componentUrl, new Long(componentAverageElapsedTime)));
                  }
                }
   
                Collections.sort(unsortedComponentStatistics, new AverageInvokingTimeComparator());
               
                if(unsortedComponentStatistics.size() > 500)
                  unsortedComponentStatistics = unsortedComponentStatistics.subList(0, 500);
               
                Iterator unsortedComponentUrlsIterator = unsortedComponentStatistics.iterator();
View Full Code Here

TOP

Related Classes of org.infoglue.cms.util.sorters.AverageInvokingTimeComparator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.