/[projects]/android/MarketStats/src/dk/thoerup/marketstats/ShowStats.java
ViewVC logotype

Diff of /android/MarketStats/src/dk/thoerup/marketstats/ShowStats.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 756 by torben, Thu May 27 08:07:28 2010 UTC revision 761 by torben, Thu May 27 11:26:05 2010 UTC
# Line 4  import java.io.IOException; Line 4  import java.io.IOException;
4  import java.io.PrintWriter;  import java.io.PrintWriter;
5  import java.net.InetSocketAddress;  import java.net.InetSocketAddress;
6  import java.util.ArrayList;  import java.util.ArrayList;
 import java.util.Collections;  
7  import java.util.Date;  import java.util.Date;
8  import java.util.Locale;  import java.util.Locale;
9  import java.util.logging.Logger;  import java.util.logging.Logger;
# Line 51  public class ShowStats extends HttpServl Line 50  public class ShowStats extends HttpServl
50          protected String doLookup(String query) throws IOException {          protected String doLookup(String query) throws IOException {
51                                    
52    
53                  String key = "marketstats:" + query;                  String key = "marketstats:" + query.replace(' ', '_');
54                  String response = (String) memcache.get(key);                  String response = (String) memcache.get(key);
55    
56                  if (response == null) {                  if (response == null) {
# Line 78  public class ShowStats extends HttpServl Line 77  public class ShowStats extends HttpServl
77                          if (start > 0)                                                    if (start > 0)                          
78                                  count = Math.min(10, commentsCb.getEntryCount() );                                  count = Math.min(10, commentsCb.getEntryCount() );
79                                                    
80                          //log.warning("count=" + count + " start=" + start );                          //log.warning("count=" + count + " start=" + start + " entryCount=" + commentsCb.getEntryCount() );
81                          CommentsRequest commentsRequest = CommentsRequest.newBuilder()                          CommentsRequest commentsRequest = CommentsRequest.newBuilder()
82                          .setAppId(appId)                          .setAppId(appId)
83                          .setStartIndex(start)                          .setStartIndex(start)
# Line 89  public class ShowStats extends HttpServl Line 88  public class ShowStats extends HttpServl
88                          session.flush();                          session.flush();
89                          start +=10;                          start +=10;
90                                                    
91                          if (start >= 50)                          if (start >= 200)
92                                  break; //emergency brake                                  break; //emergency brake
93                                                    
94                  } while ( start < commentsCb.getEntryCount() );                  } while ( start < commentsCb.getEntryCount() );
# Line 138  public class ShowStats extends HttpServl Line 137  public class ShowStats extends HttpServl
137                          }                          }
138                          sb.append("Comments: " + commentBeans.size() + "\n");                          sb.append("Comments: " + commentBeans.size() + "\n");
139                  }                  }
140                  sb.append("Cache.Timeout=" + TIMEOUT/60 + " minutes");                            sb.append("<!--Cache.Timeout=" + TIMEOUT/60 + " minutes-->\n");        
141    
142    
143                  return sb.toString();                  return sb.toString();

Legend:
Removed from v.756  
changed lines
  Added in v.761

  ViewVC Help
Powered by ViewVC 1.1.20