summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/FactoryACMMonitor.java
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2014-07-23 15:06:02 -0230
committerMatthew Newhook <matthew@zeroc.com>2014-07-23 15:06:02 -0230
commit866f9ff17391176b836f9bb49f6da40c2c938441 (patch)
tree7366963294ef3356c7b887cd89af753988c21beb /java/src/IceInternal/FactoryACMMonitor.java
parentadding ACM tests for Python/Ruby/PHP (diff)
downloadice-866f9ff17391176b836f9bb49f6da40c2c938441.tar.bz2
ice-866f9ff17391176b836f9bb49f6da40c2c938441.tar.xz
ice-866f9ff17391176b836f9bb49f6da40c2c938441.zip
ICE-4234 - Update Ice to use current Java threading constructs
- Use ScheduledThreadPoolDispatcher not IceUtilInternal.Timer. - Use Ice timer in glacier2, Freeze impl. - Align C++, C# with java changes. - Database demo now supports mariadb.
Diffstat (limited to 'java/src/IceInternal/FactoryACMMonitor.java')
-rw-r--r--java/src/IceInternal/FactoryACMMonitor.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/java/src/IceInternal/FactoryACMMonitor.java b/java/src/IceInternal/FactoryACMMonitor.java
index a1071e8a4b6..7a328a8b790 100644
--- a/java/src/IceInternal/FactoryACMMonitor.java
+++ b/java/src/IceInternal/FactoryACMMonitor.java
@@ -74,7 +74,9 @@ class FactoryACMMonitor implements ACMMonitor
if(_connections.isEmpty())
{
_connections.add(connection);
- _instance.timer().scheduleRepeated(this, _config.timeout / 2);
+ assert _future == null;
+ _future = _instance.timer().scheduleAtFixedRate(this, _config.timeout / 2, _config.timeout / 2,
+ java.util.concurrent.TimeUnit.MILLISECONDS);
}
else
{
@@ -148,7 +150,7 @@ class FactoryACMMonitor implements ACMMonitor
}
public void
- runTimerTask()
+ run()
{
synchronized(this)
{
@@ -172,7 +174,8 @@ class FactoryACMMonitor implements ACMMonitor
if(_connections.isEmpty())
{
- _instance.timer().cancel(this);
+ _future.cancel(false);
+ _future = null;
return;
}
}
@@ -212,5 +215,6 @@ class FactoryACMMonitor implements ACMMonitor
private java.util.Set<Ice.ConnectionI> _connections = new java.util.HashSet<Ice.ConnectionI>();
private java.util.List<Change> _changes = new java.util.ArrayList<Change>();
private java.util.List<Ice.ConnectionI> _reapedConnections = new java.util.ArrayList<Ice.ConnectionI>();
+ private java.util.concurrent.Future<?> _future;
};