diff options
author | Benoit Foucher <benoit@zeroc.com> | 2015-09-14 15:43:34 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2015-09-14 15:43:34 +0200 |
commit | 13bed6dec104b53fadf723aead0dc15dc3f2afd8 (patch) | |
tree | d6401dbe7d70d65e04e448439e4056c1fa4d7e8c /js | |
parent | Removed ARM configuraton from WinRT testsuite solutions (diff) | |
download | ice-13bed6dec104b53fadf723aead0dc15dc3f2afd8.tar.bz2 ice-13bed6dec104b53fadf723aead0dc15dc3f2afd8.tar.xz ice-13bed6dec104b53fadf723aead0dc15dc3f2afd8.zip |
Fixed ICE-6812 - JavaScript ACM monitor bug
Diffstat (limited to 'js')
-rw-r--r-- | js/src/Ice/ACM.js | 30 | ||||
-rw-r--r-- | js/test/Ice/acm/Client.js | 16 | ||||
-rw-r--r-- | js/test/Ice/acm/Test.ice | 1 |
3 files changed, 24 insertions, 23 deletions
diff --git a/js/src/Ice/ACM.js b/js/src/Ice/ACM.js index e6d926c8469..084bb44081d 100644 --- a/js/src/Ice/ACM.js +++ b/js/src/Ice/ACM.js @@ -23,7 +23,7 @@ var ACMConfig = Class({ this.close = Ice.ACMClose.CloseOnInvocationAndIdle; return; } - + var timeoutProperty; if((prefix == "Ice.ACM.Client" || prefix == "Ice.ACM.Server") && p.getProperty(prefix + ".Timeout").length === 0) @@ -34,7 +34,7 @@ var ACMConfig = Class({ { timeoutProperty = prefix + ".Timeout"; } - + this.timeout = p.getPropertyAsIntWithDefault(timeoutProperty, dflt.timeout / 1000) * 1000; // To ms var hb = p.getPropertyAsIntWithDefault(prefix + ".Heartbeat", dflt.heartbeat.value); @@ -44,7 +44,7 @@ var ACMConfig = Class({ } else { - l.warning("invalid value for property `" + prefix + ".Heartbeat" + + l.warning("invalid value for property `" + prefix + ".Heartbeat" + "', default value will be used instead"); this.heartbeat = dflt.heartbeat; } @@ -56,7 +56,7 @@ var ACMConfig = Class({ } else { - l.warning("invalid value for property `" + prefix + ".Close" + + l.warning("invalid value for property `" + prefix + ".Close" + "', default value will be used instead"); this.close = dflt.close; } @@ -119,8 +119,8 @@ var FactoryACMMonitor = Class(ACMMonitor, { this._timerToken = this._instance.timer().scheduleRepeated( function() { - self.runTimerTask(); - }, + self.runTimerTask(); + }, this._config.timeout / 2); } }, @@ -130,7 +130,7 @@ var FactoryACMMonitor = Class(ACMMonitor, { { return; } - + var i = this._connections.indexOf(connection); Debug.assert(i >= 0); this._connections.splice(i, 1); @@ -147,7 +147,7 @@ var FactoryACMMonitor = Class(ACMMonitor, { acm: function(timeout, close, heartbeat) { Debug.assert(this._instance !== null); - + var config = new ACMConfig(); config.timeout = this._config.timeout; config.close = this._config.close; @@ -186,7 +186,7 @@ var FactoryACMMonitor = Class(ACMMonitor, { { return; } - + // // Monitor connections outside the thread synchronization, so // that connections can be added or removed during monitoring. @@ -195,11 +195,11 @@ var FactoryACMMonitor = Class(ACMMonitor, { for(var i = 0; i < this._connections.length; i++) { try - { + { this._connections[i].monitor(now, this._config); } catch(ex) - { + { this.handleException(ex); } } @@ -209,7 +209,7 @@ var FactoryACMMonitor = Class(ACMMonitor, { if(this._instance === null) { return; - } + } this._instance.initializationData().logger.error("exception in connection monitor:\n" + ex); } }); @@ -257,11 +257,11 @@ var ConnectionACMMonitor = Class(ACMMonitor, { runTimerTask: function() { try - { - this.connection.monitor(Date.now(), this._config); + { + this._connection.monitor(Date.now(), this._config); } catch(ex) - { + { this._parent.handleException(ex); } } diff --git a/js/test/Ice/acm/Client.js b/js/test/Ice/acm/Client.js index 25ab4cbcd6c..65628559651 100644 --- a/js/test/Ice/acm/Client.js +++ b/js/test/Ice/acm/Client.js @@ -402,7 +402,7 @@ __init__: function(com, out) { TestCase.call(this, "setACM/getACM", com, out); - this.setClientACM(15, 4, 2); + this.setClientACM(15, 4, 0); }, runTestCase: function(adapter, proxy) { @@ -410,23 +410,23 @@ acm = proxy.ice_getCachedConnection().getACM(); test(acm.timeout === 15); test(acm.close === Ice.ACMClose.CloseOnIdleForceful); - test(acm.heartbeat === Ice.ACMHeartbeat.HeartbeatOnIdle); + test(acm.heartbeat === Ice.ACMHeartbeat.HeartbeatOff); proxy.ice_getCachedConnection().setACM(undefined, undefined, undefined); acm = proxy.ice_getCachedConnection().getACM(); test(acm.timeout === 15); test(acm.close === Ice.ACMClose.CloseOnIdleForceful); - test(acm.heartbeat === Ice.ACMHeartbeat.HeartbeatOnIdle); + test(acm.heartbeat === Ice.ACMHeartbeat.HeartbeatOff); - proxy.ice_getCachedConnection().setACM(20, + proxy.ice_getCachedConnection().setACM(1, Ice.ACMClose.CloseOnInvocationAndIdle, - Ice.ACMHeartbeat.HeartbeatOnInvocation); + Ice.ACMHeartbeat.HeartbeatAlways); acm = proxy.ice_getCachedConnection().getACM(); - test(acm.timeout === 20); + test(acm.timeout === 1); test(acm.close === Ice.ACMClose.CloseOnInvocationAndIdle); - test(acm.heartbeat === Ice.ACMHeartbeat.HeartbeatOnInvocation); + test(acm.heartbeat === Ice.ACMHeartbeat.HeartbeatAlways); - return new Ice.Promise().succeed(); + return proxy.waitForHeartbeat(2); } }); diff --git a/js/test/Ice/acm/Test.ice b/js/test/Ice/acm/Test.ice index fcc420b58ea..d3c1a83e37f 100644 --- a/js/test/Ice/acm/Test.ice +++ b/js/test/Ice/acm/Test.ice @@ -18,6 +18,7 @@ interface TestIntf void sleep(int seconds); void sleepAndHold(int seconds); void interruptSleep(); + void waitForHeartbeat(int count); }; interface RemoteObjectAdapter |