Is there a way to "cut down" jdbc call (commit or statement execution) to Postgres after specific timeout with millisecond accuracy?
JDBC driver docs propose loginTimeout
, socketTimeout
, connectTimeout
, cancelSignalTimeout
, statement_timeout
, yet all of them but the latter have second accuracy.
JDBC Statement api propose setQueryTimeout
, yet with second accuracy too.
statement_timeout
alone "kinda" works - driver logs show some requests being timed out, yet client stats (tracing) show a lot of calls wait way too long, even when they are cancelled on server side.
Working (yet too lame) solution - calling Thread.interrupt()
on jdbc thread (e.g. with some ScheduledExecutorService
), hoping jdbc to send cancel signal on InterruptedException
.
Asking for the advice, maybe smb got this working in more human way.