diff options
author | Matthew Newhook <matthew@zeroc.com> | 2008-08-26 15:32:09 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2008-08-26 15:32:09 -0230 |
commit | d2d1ae0ca7d03f0b67f5c2086bff18f78331682d (patch) | |
tree | 966bdc697be9249585c02dd9dbbb27bfc1695c6b /java/demo/Database/library/ReapThread.java | |
parent | move the query objects to the library. (diff) | |
download | ice-d2d1ae0ca7d03f0b67f5c2086bff18f78331682d.tar.bz2 ice-d2d1ae0ca7d03f0b67f5c2086bff18f78331682d.tar.xz ice-d2d1ae0ca7d03f0b67f5c2086bff18f78331682d.zip |
Minor cleanup, added session timeout.
Diffstat (limited to 'java/demo/Database/library/ReapThread.java')
-rw-r--r-- | java/demo/Database/library/ReapThread.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/java/demo/Database/library/ReapThread.java b/java/demo/Database/library/ReapThread.java index cf38b79a132..790abcd8350 100644 --- a/java/demo/Database/library/ReapThread.java +++ b/java/demo/Database/library/ReapThread.java @@ -32,9 +32,10 @@ class ReapThread extends Thread SessionI session; } - ReapThread(Ice.Logger logger) + ReapThread(Ice.Logger logger, long timeout) { _logger = logger; + _timeout = timeout; } synchronized public void @@ -44,7 +45,7 @@ class ReapThread extends Thread { try { - wait(1000); + wait((_timeout / 2) * 1000); } catch(InterruptedException e) { @@ -63,7 +64,7 @@ class ReapThread extends Thread // real-world example. Therefore the current time // is computed for each iteration. // - if((System.currentTimeMillis() - s.session.timestamp()) > _timeout) + if((System.currentTimeMillis() - s.session.timestamp()) > _timeout * 1000) { _logger.trace("ReapThread", "The session " + s.proxy.ice_getCommunicator().identityToString(s.proxy.ice_getIdentity()) + @@ -119,7 +120,7 @@ class ReapThread extends Thread _sessions.add(new SessionProxyPair(proxy, session)); } - private final long _timeout = 10 * 1000; // 10 seconds. + private final long _timeout; // Seconds. private Ice.Logger _logger; private boolean _terminated = false; private java.util.List<SessionProxyPair> _sessions = new java.util.LinkedList<SessionProxyPair>(); |