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; |
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) { |
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) |
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() ); |
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(); |