Package com.google.appengine.api.quota

Examples of com.google.appengine.api.quota.QuotaService


  static AverageStat feedToMeTimeStat = StatsServlet
      .createAverageStat("feed_to_me_total_time");

  @Override
  public SearchResponse feedToMe() throws MeException {
    QuotaService qs = QuotaServiceFactory.getQuotaService();
    long start = qs.getCpuTimeInMegaCycles();
    long t = System.currentTimeMillis();
    SearchResponse response = null;
    try {
      long temp = t;
      Participant pi = pm.findParticipantByEmail(getUserId());
      long endtime = System.currentTimeMillis();
      LOG.info("For TOME findParticipantByEmail(getUserId()) "
          + (endtime - temp));
      if (pi == null) {
        return new SearchResponse();
      }
      response = filterList(pi.getLocation().getLat(), pi.getLocation()
          .getLon(), pi.getLoc().getLocationString(), pi.getLoc()
          .getActiveRadius(), pi.getHasSubjects(), pi
          .getNeedSubjects());

      response = filterMe(pi, response);

      feedRanker.rank(response, pi);
      long end = qs.getCpuTimeInMegaCycles();
      double cpuSeconds = qs.convertMegacyclesToCpuSeconds(end - start);
      LOG.info("TOME CPU Usage : " + cpuSeconds);
      return response;
    } catch (MentorException e) {
      e.printStackTrace();
    } finally {
View Full Code Here


  static AverageStat localActivityTimeStat = StatsServlet
      .createAverageStat("local_activity_total_time");

  @Override
  public SearchResponse localActivity() {
    QuotaService qs = QuotaServiceFactory.getQuotaService();
    long start = qs.getCpuTimeInMegaCycles();
    long t = System.currentTimeMillis();
    SearchResponse response = new SearchResponse();
    try {
      List<SearchResult> has = new ArrayList<SearchResult>();
      List<SearchResult> need = new ArrayList<SearchResult>();

      long temp = System.currentTimeMillis();
      Participant pi = pm.findParticipantByEmail(getUserId());
      LOG.info("For Local Activity findParticipantByEmail(getUserId()) "
          + (System.currentTimeMillis() - temp));

      if (pi == null) {
        return response;
      }
      Location location = new Location(pi.getLocation().getLat(), pi
          .getLocation().getLon(), pi.getLoc().getLocationString(),
          pi.getLoc().getActiveRadius());

      temp = System.currentTimeMillis();
      List<Participant> participants = pm
          .searchParticipantsByLocation(location);
      LOG.info("For Local Activity searchParticipantsByLocation(location) "
              + (System.currentTimeMillis() - temp));
      for (Participant p : participants) {
        double distance = GeocellUtils.distance(pi.getLocation(), p
            .getLocation());
        has.add(new SearchResult(ValueObjectGenerator.create(p), true,
            p.getHasSubjects(), distance));
        need.add(new SearchResult(ValueObjectGenerator.create(p),
            false, p.getNeedSubjects(), distance));
      }

      temp = System.currentTimeMillis();
      List<Opportunity> opportunities = om.allOpportunites(location);
      LOG.info("For Local Activity allOpportunites(location) "
          + (System.currentTimeMillis() - temp));
      for (Opportunity o : opportunities) {
        need.add(new SearchResult(ValueObjectGenerator.create(o), o
            .getSubjects(), GeocellUtils.distance(pi.getLocation(),
            o.getLocation())));
      }
      response.setHas(has);
      response.setNeed(need);
      response = filterMe(pi, response);
      long end = qs.getCpuTimeInMegaCycles();
      double cpuSeconds = qs.convertMegacyclesToCpuSeconds(end - start);
      LOG.info("Local Activity CPU Usage : " + cpuSeconds);
      return response;
    } catch (MentorException e) {
      e.printStackTrace();
    } finally {
View Full Code Here

TOP

Related Classes of com.google.appengine.api.quota.QuotaService

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.