summaryrefslogtreecommitdiff
path: root/java/demo/Database/library/Server.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/demo/Database/library/Server.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/demo/Database/library/Server.java')
-rw-r--r--java/demo/Database/library/Server.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/java/demo/Database/library/Server.java b/java/demo/Database/library/Server.java
index c5fb2f4f940..e1f7b6816a2 100644
--- a/java/demo/Database/library/Server.java
+++ b/java/demo/Database/library/Server.java
@@ -64,7 +64,7 @@ class Server extends Ice.Application
try
{
- Class.forName("com.mysql.jdbc.Driver").newInstance();
+ Class.forName(properties.getProperty("JDBC.DriverClassName")).newInstance();
}
catch(Exception e)
{
@@ -92,9 +92,10 @@ class Server extends Ice.Application
long timeout = properties.getPropertyAsIntWithDefault("SessionTimeout", 30);
- ReapThread reaper = new ReapThread(logger, timeout);
- reaper.start();
-
+ java.util.concurrent.ScheduledExecutorService executor = java.util.concurrent.Executors.newScheduledThreadPool(1);
+ ReapTask reaper = new ReapTask(logger, timeout);
+ executor.scheduleAtFixedRate(reaper, timeout/2, timeout/2, java.util.concurrent.TimeUnit.SECONDS);
+
//
// Create an object adapter
//
@@ -116,14 +117,8 @@ class Server extends Ice.Application
communicator().waitForShutdown();
defaultInterrupt();
+ executor.shutdown();
reaper.terminate();
- try
- {
- reaper.join();
- }
- catch(InterruptedException e)
- {
- }
pool.destroy();