Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class SingleConnectionDataSource extends BaseClassBasedDataSource impleme
private final boolean autoReconnect;
@Setter
private EventPublisher eventPublisher;
protected Connection connection;
protected volatile Connection connection;
private final List<ConnectionInitializer> initializerList = new LinkedList<>();
private Lock lock;
@Setter
Expand Down Expand Up @@ -96,7 +96,7 @@ public Connection getConnection(String username, String password) throws SQLExce
/**
* Reset a {@code Connection}
*/
public void resetConnection() throws SQLException {
public synchronized void resetConnection() throws SQLException {
log.info("The connection will be reset soon");
close();
this.connection = null;
Expand Down Expand Up @@ -181,7 +181,7 @@ private void onConnectionReset(Connection connection) {
}
}

private Connection innerCreateConnection() throws SQLException {
private synchronized Connection innerCreateConnection() throws SQLException {
if (this.connection != null) {
throw new IllegalStateException("Connection is not null");
}
Expand Down