How can I apply query timeout to PostgreSQLValidConnectionChecker?
Issue
- How can I apply query timeout to PostgreSQLValidConnectionChecker?
- If the database is down, the following log will be shown more than 900 seconds after the
getConnection()
call. Is there any way to make it timeout more quickly?
11:07:27,041 WARN [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (default task-1) IJ030027: Destroying connection that is not valid, due to the following exception: org.postgresql.jdbc.PgConnection@60521c94: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:350)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:322)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:308)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:284)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:279)
at org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker.isValidConnection(PostgreSQLValidConnectionChecker.java:61)
...
Caused by: java.net.SocketException: No route to host (Read failed)
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:161)
at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:128)
at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:113)
at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73)
at org.postgresql.core.PGStream.receiveChar(PGStream.java:443)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2057)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323)
... 62 more
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.