I was curious about particular test case and wanted to know if even its a realistic scenario.
public void doSomething()
{
ResultSet rs = null;
PreparedStatement ps = null;
try
{
ps = conn.createStatement(/* some query */);
ps.executeUpdate();
rs = ps.getGeneratedKeys();
rs.next();
int temp = rs.getInt(1);
} catch(Exception e ) { /* Exception Handlign */}
finally {
ps.close();
rs.close();
}
}
For the above code, would rs.getInt(1) be threadSafe? I have a single Connection object. The scenario seems highly unlikely to me but I still wanted your opinion.
Thanks