Bug CS-17825: Don't rely on XS to cleanup idle session but proactively close it from console proxy

This commit is contained in:
Kelven Yang 2013-06-10 17:46:22 -07:00
parent 4fce6448e6
commit f38c4e9ea6
5 changed files with 16 additions and 6 deletions

View File

@ -253,7 +253,8 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons
if(s_logger.isTraceEnabled())
s_logger.trace("Ajax client start, frame buffer w: " + width + ", " + height);
/*
int retry = 0;
tracker.initCoverageTest();
while(!tracker.hasFullCoverage() && retry < 10) {
@ -263,6 +264,7 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons
}
retry++;
}
*/
List<TileInfo> tiles = tracker.scan(true);
String imgUrl = prepareAjaxImage(tiles, true);

View File

@ -64,6 +64,7 @@ public class ConsoleProxyGCThread extends Thread {
public void run() {
boolean bReportLoad = false;
long lastReportTick = System.currentTimeMillis();
while (true) {
cleanupLogging();
bReportLoad = false;
@ -95,10 +96,12 @@ public class ConsoleProxyGCThread extends Thread {
client.closeClient();
}
if(bReportLoad) {
if(bReportLoad || System.currentTimeMillis() - lastReportTick > 5000) {
// report load changes
String loadInfo = new ConsoleProxyClientStatsCollector(connMap).getStatsReport();
ConsoleProxy.reportLoadInfo(loadInfo);
lastReportTick = System.currentTimeMillis();
if(s_logger.isDebugEnabled())
s_logger.debug("Report load change : " + loadInfo);
}

View File

@ -46,7 +46,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
private VncClient client;
private Thread worker;
private boolean workerDone = false;
private volatile boolean workerDone = false;
private int lastModifierStates = 0;
private int lastPointerMask = 0;
@ -80,7 +80,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
String tunnelUrl = getClientParam().getClientTunnelUrl();
String tunnelSession = getClientParam().getClientTunnelSession();
for(int i = 0; i < 15; i++) {
for(int i = 0; i < 15 && !workerDone; i++) {
try {
if(tunnelUrl != null && !tunnelUrl.isEmpty() && tunnelSession != null && !tunnelSession.isEmpty()) {
URI uri = new URI(tunnelUrl);
@ -136,6 +136,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
@Override
public void closeClient() {
workerDone = true;
if(client != null)
client.shutdown();
}

View File

@ -77,8 +77,10 @@ public class VncClientPacketSender implements Runnable, PaintNotificationListene
s_logger.error("Unexpected exception: ", e);
if (connectionAlive) {
closeConnection();
vncConnection.shutdown();
}
} finally {
s_logger.info("Sending thread exit processing, shutdown connection");
vncConnection.shutdown();
}
}

View File

@ -90,8 +90,10 @@ public class VncServerPacketReceiver implements Runnable {
s_logger.error("Unexpected exception: ", e);
if (connectionAlive) {
closeConnection();
vncConnection.shutdown();
}
} finally {
s_logger.info("Receiving thread exit processing, shutdown connection");
vncConnection.shutdown();
}
}