Skip to content

Commit ae1b616

Browse files
committed
Partially address lesv feedback.
1 parent 61952d4 commit ae1b616

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

cloud-sql/mysql/servlet/pom.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@
3737
</properties>
3838

3939
<dependencies>
40-
41-
<!-- Required only for AppEngine Standard -->
42-
<dependency>
43-
<groupId>com.google.appengine</groupId>
44-
<artifactId>appengine-api-1.0-sdk</artifactId>
45-
<version>1.9.64</version>
46-
</dependency>
47-
4840
<dependency>
4941
<groupId>javax.servlet</groupId>
5042
<artifactId>javax.servlet-api</artifactId>
@@ -79,6 +71,7 @@
7971
<scanIntervalSeconds>1</scanIntervalSeconds>
8072
</configuration>
8173
</plugin>
74+
<!-- Only required for AppEngine Deployments -->
8275
<plugin>
8376
<groupId>com.google.cloud.tools</groupId>
8477
<artifactId>appengine-maven-plugin</artifactId>

cloud-sql/mysql/servlet/src/main/java/com/example/cloudsql/ConnectionPoolContextListener.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import javax.servlet.annotation.WebListener;
2727
import javax.sql.DataSource;
2828

29-
@WebListener
29+
@WebListener("Creates a connection pool that is stored in the Servlet's context for later use.")
3030
public class ConnectionPoolContextListener implements ServletContextListener {
3131

3232
private static final String CLOUD_SQL_INSTANCE_NAME = System.getenv("CLOUD_SQL_INSTANCE_NAME");
@@ -74,7 +74,9 @@ private DataSource mysqlConnectionPool() {
7474

7575
// [START cloud_sql_connection_lifetime]
7676
// maxLifetime is the maximum possible lifetime of a connection in the pool. Connections that
77-
// live longer than this many milliseconds will be closed and reestablished between uses.
77+
// live longer than this many milliseconds will be closed and reestablished between uses. This
78+
// value should be several minutes shorter than the database's timeout value to avoid unexpected
79+
// terminations.
7880
config.setMaxLifetime(1800000); // 30 minutes
7981
// [END cloud_sql_connection_lifetime]
8082

cloud-sql/mysql/servlet/src/main/webapp/WEB-INF/appengine-web.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
<env-var name="DB_PASS" value="my-db-password" />
2424
<env-var name="DB_NAME" value="my_db" />
2525
</env-variables>
26-
</appengine-web-app>
26+
</appengine-web-app>

0 commit comments

Comments
 (0)