T
Size: a a a
T
A
JDBCDriver.getConnection(String url, Properties info)
…
long timeout = 0;
if (info != null) {
timeout = HsqlProperties.getIntegerProperty(info, "loginTimeout", 0);
}
props.addProperties(info);
if (timeout == 0) {
timeout = DriverManager.getLoginTimeout();
}
// @todo: maybe impose some sort of sane restriction
// on network connections regardless of user
// specification?
if (timeout == 0) {
// no timeout restriction
return new JDBCConnection(props);
}
…
// @todo: Better: ThreadPool? HsqlTimer with callback?
final JDBCConnection[] conn = new JDBCConnection[1];
final SQLException[] ex = new SQLException[1];
Thread t = new Thread() {
public void run() {
try {
conn[0] = new JDBCConnection(props);
} catch (SQLException se) {
ex[0] = se;
}
}
};
t.start();
try {
t.join(1000 * timeout);
} catch (InterruptedException ie) {
}
try {
// PRE:
// deprecated, but should be ok, since neither
// the HSQLClientConnection or the HTTPClientConnection
// constructor will ever hold monitors on objects in
// an inconsistent state, such that damaged objects
// become visible to other threads with the
// potential of arbitrary behavior.
t.stop();
} catch (Exception e) {
} finally {
try {
t.setContextClassLoader(null);
} catch (Throwable th) {
}
}
join(1000 * timeout).
Почему не банальный sleep(100 * timeout)
?ИМ
Lr
AE
AE
Lr
Lr
AE
Lr
AE
AE
Lr
Lr
QH
Lr
QH
Lr