OPENJPA-1067. Merely log SQLException from setQueryTimeout for DB2 on Z/OS

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@778903 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2009-05-26 21:49:33 +00:00
parent 3187b81415
commit ca79571829
2 changed files with 22 additions and 3 deletions

View File

@ -360,14 +360,27 @@ public class SelectImpl
// the configured query timeout, use the lock timeout // the configured query timeout, use the lock timeout
if (forUpdate && _dict.supportsQueryTimeout && fetch != null if (forUpdate && _dict.supportsQueryTimeout && fetch != null
&& fetch.getLockTimeout() > stmnt.getQueryTimeout() * 1000) { && fetch.getLockTimeout() > stmnt.getQueryTimeout() * 1000) {
Log log = _conf.getLog(JDBCConfiguration.LOG_JDBC);
int timeout = fetch.getLockTimeout(); int timeout = fetch.getLockTimeout();
if (timeout < 1000) { if (timeout < 1000) {
timeout = 1000; timeout = 1000;
Log log = _conf.getLog(JDBCConfiguration.LOG_JDBC);
if (log.isWarnEnabled()) if (log.isWarnEnabled())
log.warn(_loc.get("millis-query-timeout")); log.warn(_loc.get("millis-query-timeout"));
} }
stmnt.setQueryTimeout(fetch.getLockTimeout() / 1000); try {
stmnt.setQueryTimeout(fetch.getLockTimeout() / 1000);
}
catch(SQLException e) {
if(_dict.ignoreSQLExceptionOnSetQueryTimeout) {
if (log.isTraceEnabled()) {
log.trace(_loc.get("error-setting-query-timeout",
new Integer(timeout), e.getMessage()), e);
}
}
else {
throw e;
}
}
} }
rs = stmnt.executeQuery(); rs = stmnt.executeQuery();
} catch (SQLException se) { } catch (SQLException se) {

View File

@ -167,5 +167,11 @@ isolation-level-config-not-supported: This DBDictionary does not support \
customization of isolation levels on a per-query basis. DBDictionary: {0}. customization of isolation levels on a per-query basis. DBDictionary: {0}.
millis-query-timeout: JDBC locking does not support millisecond-granularity \ millis-query-timeout: JDBC locking does not support millisecond-granularity \
timeouts. Use timeouts that are multiples of 1000 for even second values. timeouts. Use timeouts that are multiples of 1000 for even second values.
db-not-supported: The database product "{0}", version "{1}" is not officially supported. db-not-supported: The database product "{0}", version "{1}" is not officially \
supported.
error-setting-query-timeout: A SQLException was thrown when trying to set the \
queryTimeout to {0}. We believe the exception is not fatal and will \
continue processing. If this is a benign error you may disable it entirely \
by setting the supportsQueryTimeout attribute on the DBDictionary to false.\
The exception thrown was {1}.