[
https://issues.apache.org/jira/browse/PHOENIX-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14279203#comment-14279203
]
James Taylor commented on PHOENIX-1582:
---------------------------------------
The props wouldn't change. You'd only use the property if no timeout was
explicitly set on PhoenixStatement. Something like this (plus one or two simple
unit tests):
{code}
public class PhoenixStatement implements Statement, SQLCloseable,
org.apache.phoenix.jdbc.Jdbc7Shim.Statement {
....
private int queryTimeOut;
public PhoenixStatement(PhoenixConnection connection) {
this.connection = connection;
this.queryTimeOut = getDefaultQueryTimeOut();
}
private int getDefaultQueryTimeOut() {
// Divide by 1000 to convert milliseconds to seconds
return
connection.getQueryServices().getProps().getInt(QueryServices.THREAD_TIMEOUT_MS_ATTRIB,
QueryServicesOptions.DEFAULT_THREAD_TIMEOUT_MS) / 1000;
}
@Override
public void setQueryTimeout(int seconds) throws SQLException {
if (seconds < 0) {
this.queryTimeOut = getDefaultQueryTimeOut();
} else if (seconds == 0) {
this.queryTimeOut = Integer.MAX_VALUE;
} else {
this.queryTimeOut = seconds;
}
}
@Override
public int getQueryTimeout() throws SQLException {
return queryTimeout;
}
...
}
public abstract class BaseResultIterators extends ExplainTable implements
ResultIterators {
...
@Override
public List<PeekingResultIterator> getIterators() throws SQLException {
...
// Get query time out from Statement and convert from seconds back to
milliseconds
int queryTimeOut = context.getStatement().getQueryTimeOut() * 1000;
...
}
....
}
{code}
> Support TimeOut in JDBC
> -----------------------
>
> Key: PHOENIX-1582
> URL: https://issues.apache.org/jira/browse/PHOENIX-1582
> Project: Phoenix
> Issue Type: Improvement
> Affects Versions: 4.2, 3.2
> Reporter: Christophe S
> Labels: Newbie
>
> Some tools as JMeter need the Timeout function in the JDBC driver to be
> implemented in order to work.
> Would it be possible to implement this function?
> Thx!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)