File tree Expand file tree Collapse file tree
console-proxy/src/com/cloud/consoleproxy Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ private void cleanupLogging() {
6464 public void run () {
6565
6666 boolean bReportLoad = false ;
67+ long lastReportTick = System .currentTimeMillis ();
6768 while (true ) {
6869 cleanupLogging ();
6970 bReportLoad = false ;
@@ -95,10 +96,12 @@ public void run() {
9596 client .closeClient ();
9697 }
9798
98- if (bReportLoad ) {
99+ if (bReportLoad || System . currentTimeMillis () - lastReportTick > 5000 ) {
99100 // report load changes
100101 String loadInfo = new ConsoleProxyClientStatsCollector (connMap ).getStatsReport ();
101102 ConsoleProxy .reportLoadInfo (loadInfo );
103+ lastReportTick = System .currentTimeMillis ();
104+
102105 if (s_logger .isDebugEnabled ())
103106 s_logger .debug ("Report load change : " + loadInfo );
104107 }
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
4646
4747 private VncClient client ;
4848 private Thread worker ;
49- private boolean workerDone = false ;
49+ private volatile boolean workerDone = false ;
5050
5151 private int lastModifierStates = 0 ;
5252 private int lastPointerMask = 0 ;
@@ -80,7 +80,7 @@ public void run() {
8080 String tunnelUrl = getClientParam ().getClientTunnelUrl ();
8181 String tunnelSession = getClientParam ().getClientTunnelSession ();
8282
83- for (int i = 0 ; i < 15 ; i ++) {
83+ for (int i = 0 ; i < 15 && ! workerDone ; i ++) {
8484 try {
8585 if (tunnelUrl != null && !tunnelUrl .isEmpty () && tunnelSession != null && !tunnelSession .isEmpty ()) {
8686 URI uri = new URI (tunnelUrl );
@@ -136,6 +136,7 @@ public void run() {
136136
137137 @ Override
138138 public void closeClient () {
139+ workerDone = true ;
139140 if (client != null )
140141 client .shutdown ();
141142 }
Original file line number Diff line number Diff line change @@ -77,8 +77,10 @@ public void run() {
7777 s_logger .error ("Unexpected exception: " , e );
7878 if (connectionAlive ) {
7979 closeConnection ();
80- vncConnection .shutdown ();
8180 }
81+ } finally {
82+ s_logger .info ("Sending thread exit processing, shutdown connection" );
83+ vncConnection .shutdown ();
8284 }
8385 }
8486
Original file line number Diff line number Diff line change @@ -90,8 +90,10 @@ public void run() {
9090 s_logger .error ("Unexpected exception: " , e );
9191 if (connectionAlive ) {
9292 closeConnection ();
93- vncConnection .shutdown ();
9493 }
94+ } finally {
95+ s_logger .info ("Receiving thread exit processing, shutdown connection" );
96+ vncConnection .shutdown ();
9597 }
9698 }
9799
You can’t perform that action at this time.
0 commit comments