Background validation is not working with custom validation checker when validate-on-match is set to false
nagarajs92 Sep 10, 2014 7:49 AMIm using postgres as DB and my datasource configuration is as follows:
<datasources>
<datasource enabled="true" jndi-name="java:/DefaultDS" jta="true" pool-name="PostgresSqlDS" use-ccm="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:55432/TEST_DB</connection-url>
<driver>postgresql</driver>
<driver-class>org.postgresql.Driver</driver-class>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<security-domain>
DefaultDSSecurityPolicy
</security-domain>
</security>
<validation>
<valid-connection-checker class-name="com.test.server.genlib.database.dberror.TestPostgreSQLValidConnectionChecker"/>
<exception-sorter class-name="com.test.server.genlib.database.dberror.TestDataBaseErrorChecker"/>
<validate-on-match>false</validate-on-match>
<background-validation>true</background-validation>
<background-validation-millis>20000</background-validation-millis>
</validation>
<timeout>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<xa-resource-timeout>0</xa-resource-timeout>
</timeout>
<statement>
<track-statements>true</track-statements>
</statement>
</datasource>
</datasources>
We are using custom classes for both error checker and Valid connection checker.
TestDataBaseErrorChecker implements TestDataBaseErrorChecker and
TestPostgreSQLValidConnectionChecker implements org.jboss.jca.adapters.jdbc.spi.ValidConnectionChecker.
We are using jboss 7.2.0 and ironjcaamar1.0.17-final.
Using this configuration.during server startup it shows a warning that "TestPostgreSQLValidConnectionChecker" cannot be loaded.
The log trace is:
2014-09-08 14:22:39,064 WARN [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] Exception trying to create valid connection checker (disabling):: java.lang.Exception: Unable to load: com.test.server.genlib.database.dberror.TestPostgreSQLValidConnectionChecker
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.loadPlugin(BaseWrapperManagedConnectionFactory.java:1027)
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:1104)
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:512)
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.getInvalidConnections(BaseWrapperManagedConnectionFactory.java:923)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.validateConnections(SemaphoreArrayListManagedConnectionPool.java:890)
at org.jboss.jca.core.connectionmanager.pool.validator.ConnectionValidator$ConnectionValidatorRunner.run(ConnectionValidator.java:277)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
But when I set "validate-on-match" as true, it works fine and the connections are checked every 20 seconds and also connections are checked when fetched from connection pool.
Here I dont want connections to be validated when it is fetched from connection pool, because background validation is already enabled, so validate-on-match will be redundant.
What am I missing here? Where "validate-on-match" should enabled always?