فهرست منبع

Undertow fixes: postgresql version now running

tfb 12 سال پیش
والد
کامیت
fdb6885e82
3فایلهای تغییر یافته به همراه9 افزوده شده و 7 حذف شده
  1. 3 3
      undertow/pom.xml
  2. 3 1
      undertow/src/main/java/hello/HelloWebServer.java
  3. 3 3
      undertow/src/main/resources/hello/server.properties

+ 3 - 3
undertow/pom.xml

@@ -13,17 +13,17 @@
         <dependency>
             <groupId>io.undertow</groupId>
             <artifactId>undertow-core</artifactId>
-            <version>1.0.0.Beta3</version>
+            <version>1.0.0.Beta17</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.xnio</groupId>
             <artifactId>xnio-api</artifactId>
-            <version>3.1.0.CR5</version>
+            <version>3.1.0.CR7</version>
         </dependency>
         <dependency>
             <groupId>org.jboss.xnio</groupId>
             <artifactId>xnio-nio</artifactId>
-            <version>3.1.0.CR5</version>
+            <version>3.1.0.CR7</version>
         </dependency>
         <!-- Database drivers -->
         <dependency>

+ 3 - 1
undertow/src/main/java/hello/HelloWebServer.java

@@ -56,7 +56,8 @@ public final class HelloWebServer {
    * @throws SQLException if reading from the SQL database (while priming the
    *                      cache) fails
    */
-  public HelloWebServer() throws IOException, SQLException {
+  public HelloWebServer() throws ClassNotFoundException, IOException, SQLException {
+    Class.forName("org.postgresql.Driver");
     Properties properties = new Properties();
     try (InputStream in = HelloWebServer.class.getResourceAsStream(
         "server.properties")) {
@@ -142,6 +143,7 @@ public final class HelloWebServer {
             .addPath("/cache",
                 new CacheHandler(objectMapper, worldCache)),
             Headers.SERVER_STRING, "undertow")))
+        .setWorkerThreads(200)
         .build()
         .start();
   }

+ 3 - 3
undertow/src/main/resources/hello/server.properties

@@ -1,14 +1,14 @@
 web.port = 8080
 web.host = 0.0.0.0
-mysql.uri = jdbc:mysql://DATABASE_HOST:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true
+mysql.uri = jdbc:mysql://tfbdata:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true
 mysql.user = benchmarkdbuser
 mysql.password = benchmarkdbpass
 #
 # TODO: Audit this postgresql connection string.
 # It looks copy & pasted from MySQL.  Do these parameters even do anything?
 #
-postgresql.uri = jdbc:postgresql://DATABASE_HOST:5432/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true
+postgresql.uri = jdbc:postgresql://tfbdata:5432/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true
 postgresql.user = benchmarkdbuser
 postgresql.password = benchmarkdbpass
-mongodb.host = DATABASE_HOST:27017
+mongodb.host = tfbdata:27017
 mongodb.name = hello_world