mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-12 10:15:49 +00:00
Merge branch 'Qortal:master' into master
This commit is contained in:
commit
39d8750ef9
@ -55,7 +55,7 @@ public class HSQLDBRepository implements Repository {
|
|||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(HSQLDBRepository.class);
|
private static final Logger LOGGER = LogManager.getLogger(HSQLDBRepository.class);
|
||||||
|
|
||||||
private static final Object CHECKPOINT_LOCK = new Object();
|
public static final Object CHECKPOINT_LOCK = new Object();
|
||||||
|
|
||||||
// "serialization failure"
|
// "serialization failure"
|
||||||
private static final Integer DEADLOCK_ERROR_CODE = Integer.valueOf(-4861);
|
private static final Integer DEADLOCK_ERROR_CODE = Integer.valueOf(-4861);
|
||||||
@ -703,8 +703,11 @@ public class HSQLDBRepository implements Repository {
|
|||||||
private ResultSet checkedExecuteResultSet(PreparedStatement preparedStatement, Object... objects) throws SQLException {
|
private ResultSet checkedExecuteResultSet(PreparedStatement preparedStatement, Object... objects) throws SQLException {
|
||||||
bindStatementParams(preparedStatement, objects);
|
bindStatementParams(preparedStatement, objects);
|
||||||
|
|
||||||
|
// synchronize to block new executions if checkpointing in progress
|
||||||
|
synchronized (CHECKPOINT_LOCK) {
|
||||||
if (!preparedStatement.execute())
|
if (!preparedStatement.execute())
|
||||||
throw new SQLException("Fetching from database produced no results");
|
throw new SQLException("Fetching from database produced no results");
|
||||||
|
}
|
||||||
|
|
||||||
ResultSet resultSet = preparedStatement.getResultSet();
|
ResultSet resultSet = preparedStatement.getResultSet();
|
||||||
if (resultSet == null)
|
if (resultSet == null)
|
||||||
|
@ -61,6 +61,7 @@ public class HSQLDBSaver {
|
|||||||
public boolean execute(HSQLDBRepository repository) throws SQLException {
|
public boolean execute(HSQLDBRepository repository) throws SQLException {
|
||||||
String sql = this.formatInsertWithPlaceholders();
|
String sql = this.formatInsertWithPlaceholders();
|
||||||
|
|
||||||
|
synchronized (HSQLDBRepository.CHECKPOINT_LOCK) {
|
||||||
try {
|
try {
|
||||||
PreparedStatement preparedStatement = repository.prepareStatement(sql);
|
PreparedStatement preparedStatement = repository.prepareStatement(sql);
|
||||||
this.bindValues(preparedStatement);
|
this.bindValues(preparedStatement);
|
||||||
@ -70,6 +71,7 @@ public class HSQLDBSaver {
|
|||||||
throw repository.examineException(e);
|
throw repository.examineException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format table and column names into an INSERT INTO ... SQL statement.
|
* Format table and column names into an INSERT INTO ... SQL statement.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user