diff options
author | Bernard Normier <bernard@zeroc.com> | 2008-05-09 14:52:35 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2008-05-09 14:52:35 -0400 |
commit | 240165fa92360ac7f9c776a7c0ac302cb59dd65a (patch) | |
tree | 283eb0b5dfd4b7c57f71e985de1d68eb588c5327 /java/src/IceGridGUI/SessionKeeper.java | |
parent | Fixes for allDemos.py to work with Python demos on Windows (diff) | |
download | ice-240165fa92360ac7f9c776a7c0ac302cb59dd65a.tar.bz2 ice-240165fa92360ac7f9c776a7c0ac302cb59dd65a.tar.xz ice-240165fa92360ac7f9c776a7c0ac302cb59dd65a.zip |
Fixed IceGrid GUI logout hang with Glacier2
Diffstat (limited to 'java/src/IceGridGUI/SessionKeeper.java')
-rwxr-xr-x | java/src/IceGridGUI/SessionKeeper.java | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/java/src/IceGridGUI/SessionKeeper.java b/java/src/IceGridGUI/SessionKeeper.java index e68a1be189c..128ce1a7b80 100755 --- a/java/src/IceGridGUI/SessionKeeper.java +++ b/java/src/IceGridGUI/SessionKeeper.java @@ -111,6 +111,7 @@ class SessionKeeper } _thread = new Pinger(_session, keepAliveperiod); + _thread.setDaemon(true); _thread.start(); try @@ -205,18 +206,6 @@ class SessionKeeper if(_thread != null) { _thread.done(); - - for(;;) - { - try - { - _thread.join(); - break; - } - catch(InterruptedException e) - { - } - } } if(_adapter != null) @@ -1192,40 +1181,61 @@ class SessionKeeper } } - public synchronized void run() + public void run() { + boolean done = false; + do { - try + synchronized(this) { - _session.keepAlive(); + done = _done; } - catch(final Ice.LocalException e) + + if(!done) { - _done = true; + try + { + _session.keepAlive(); + } + catch(final Exception e) + { + synchronized(this) + { + done = _done; + _done = true; + } - SwingUtilities.invokeLater(new Runnable() + if(!done) { - public void run() - { - sessionLost("Failed to contact the IceGrid registry: " - + e.toString()); - } - }); + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + sessionLost("Failed to contact the IceGrid registry: " + + e.toString()); + } + }); + } + } } - if(!_done) + synchronized(this) { - try - { - wait(_period); - } - catch(InterruptedException e) + if(!_done) { - // Ignored + try + { + wait(_period); + } + catch(InterruptedException e) + { + // Ignored + } } + done = _done; } - } while(!_done); + } while(!done); } public synchronized void done() |