You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the fact the local variales must be final in java lambda function the Runnable poll in lazyStart seems to have moved the variable pollcounter into poll. The existing code is
Runnablepoll = newRunnable() {
publicvoidrun() {
intpollcounter = 0;
pollcounter++;
// host still is unreachable start hostif ( tunnel.isOpen()){
if (pollcounter * period < 10000){ // 60 seconds # TODO make configurableconnecting = executor.schedule(this,period,TimeUnit.MILLISECONDS);
} else{
logger.debug("start command after:",(period * pollcounter ) / 1000);
starting = executor.schedule(startTask,0,TimeUnit.MILLISECONDS);
}
} else {
// if stop command is already running, it will start after stopcommand has finished # TODO not true// because executor is single trheadedstarting = executor.schedule(startTask,0,TimeUnit.MILLISECONDS);
}
}
};
As you can see the variable pollcounter is reset to zero at each call to poll this effectively means that if tunnel.isOpen() is always true this poller never exits. I have this case will using guacamoleTrigger with the OAuth authenticator, where it seems that the OAuth authenticator opens the tunnel to guacd, my start script never runs.
Can I propose that rather than using a counter, we set an end data in lazyStart so that the local variable in lazyStartis final. I propose the patch
--- a/src/main/java/org/apache/guacamole/guacamoletrigger/auth/Host.java+++ b/src/main/java/org/apache/guacamole/guacamoletrigger/auth/Host.java@@ -235,18 +235,16 @@ public class Host {
// if Tunnel is already closed, try to start host direct
Runnable startTask = new Runnable() { public void run() { start(user, env); }};
int period = 200;
+ long endpoll = System.currentTimeMillis() + 10000; // 10 seconds # TODO make configurable
Runnable poll = new Runnable() {
public void run() {
-- int pollcounter = 0;- pollcounter++;
// host still is unreachable start host
if ( tunnel.isOpen()){
- if (pollcounter * period < 10000){ // 60 seconds # TODO make configurable+ if (System.currentTimeMillis() < endpoll){
connecting = executor.schedule(this,period,TimeUnit.MILLISECONDS);
} else{
- logger.debug("start command after:",(period * pollcounter ) / 1000);+ logger.debug("start command at: {}",System.currentTimeMillis());
starting = executor.schedule(startTask,0,TimeUnit.MILLISECONDS);
}
} else {
The text was updated successfully, but these errors were encountered:
Due to the fact the local variales must be final in java lambda function the Runnable
poll
inlazyStart
seems to have moved the variablepollcounter
intopoll
. The existing code isAs you can see the variable
pollcounter
is reset to zero at each call topoll
this effectively means that iftunnel.isOpen()
is always true this poller never exits. I have this case will using guacamoleTrigger with the OAuth authenticator, where it seems that the OAuth authenticator opens the tunnel toguacd
, my start script never runs.Can I propose that rather than using a counter, we set an end data in
lazyStart
so that the local variable inlazyStart
is final. I propose the patchThe text was updated successfully, but these errors were encountered: