Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1cbb682

Browse files
author
zhourenjian
committed
Fixed bug that Hotspot swapped SimpleRPCRunnable subclasses may register its fields more than once.
Fixed bug that Hotspot classes list from server side may be cached by browser, use random query to avoid such bugs and server side will also send out Pragma: no-cache.
1 parent 8752e47 commit 1cbb682

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/net/sf/j2s/core/hotspot/HotspotWorker.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ void handleClient() throws IOException {
158158
ps.write(EOL);
159159
ps.print("Content-type: text/javascript");
160160
ps.write(EOL);
161+
ps.print("Pragma: no-cache");
162+
ps.write(EOL);
161163
if (doingGet) {
162164
sendLatestHotspot(sessionID, ps);
163165
}
@@ -170,8 +172,8 @@ void sendLatestHotspot(long session, PrintStream ps) throws IOException {
170172
ps.write(EOL);
171173
StringBuffer strBuf = new StringBuffer();
172174
strBuf.append("ClazzLoader.updateHotspot (");
173-
long time = 0;
174-
while (time < 5000) {
175+
long time = new Date().getTime();
176+
while (new Date().getTime() - time < 5000) {
175177
String hotspotJS = InnerHotspotServer.getHotspotJavaScript(session);
176178
if (hotspotJS.length() != 0) {
177179
strBuf.append("\r\n");
@@ -193,7 +195,6 @@ public void run() {
193195
} catch (InterruptedException e) {
194196
e.printStackTrace();
195197
}
196-
time += 250;
197198
}
198199
}
199200
strBuf.append("null);");

0 commit comments

Comments
 (0)