This closes #2235 Make JDBC OpenFile Thread Safe

This commit is contained in:
andytaylor 2018-08-10 13:35:23 +01:00
commit 3ac7b9aef6
1 changed files with 8 additions and 6 deletions

View File

@ -108,12 +108,14 @@ public class JDBCSequentialFileFactoryDriver extends AbstractJDBCDriver {
* @throws SQLException * @throws SQLException
*/ */
public void openFile(JDBCSequentialFile file) throws SQLException { public void openFile(JDBCSequentialFile file) throws SQLException {
final long fileId = fileExists(file); synchronized (connection) {
if (fileId < 0) { final long fileId = fileExists(file);
createFile(file); if (fileId < 0) {
} else { createFile(file);
file.setId(fileId); } else {
loadFile(file); file.setId(fileId);
loadFile(file);
}
} }
} }