I believe that setting the interrupted bit back on for the thread and throwing SQLException is the correct option.
Any threads that catch InterruptedException should either (in preference order)
1) rethrow it as is (if allowed by method signature)
2) set the interrupted bit and throw some other exception
3) continue and set the interrupted bit in finally block (only for critical methods that are doing some important cleanup)
-Mikko
From: pgsql-jdbc-owner@postgresql.org <pgsql-jdbc-owner@postgresql.org> on behalf of Dave Cramer <pg@fastcrypt.com>
Sent: 12 August 2013 19:22
To: Andreas Rudolph
Cc: List
Subject: Re: [JDBC] BUG org.postgresql.Driver.connect() distorts InterruptedException
Ok, so you would like the code to not reset the interrupted exception so that when it returns the interrupted bit will still be set and you can check for isInterrupted ?
The SQL error is rather vague here since it is not really a SQL error, rather someone cancelled the thread.