在microSeconds中设置查询超时

In addition to the standard JDBC Statement#setQueryTimeout() method which allows you to specify a query timeout in whole seconds, NuoDB also provides a setQueryTimeoutMicros() method in the implementation class, RemStatement.

The setQueryTimeoutMicros() method allows you to specify the number of microseconds for the timeout. 该参数是长的。

There is also an RemStatement#getQueryTimeoutMicros() which returns the timeout value as a long value which is the number of microseconds.

To use RemStatement#setQueryTimeoutMicros(), you must cast a Statement object to an RemStatement object as in the code snippet below.

Casting from Statement to RemStatement should be done with extreme caution as the underlying RemStatement implementation class is subject to change.

在这里,我们将查询超时设置为500,000微秒或1/2秒。

if (pStatement instanceof RemStatement)
    ((RemStatement)pStatement).setQueryTimeoutMicros(500000);