forked from Qortal/qortal
Move HSQLDBRepositoryFactory.POOL_SIZE into Settings as "repositoryConnectionPoolSize"
This commit is contained in:
parent
0fc5153f9b
commit
bce66bf57f
@ -14,11 +14,11 @@ import org.hsqldb.jdbc.HSQLDBPool;
|
|||||||
import org.qortal.repository.DataException;
|
import org.qortal.repository.DataException;
|
||||||
import org.qortal.repository.Repository;
|
import org.qortal.repository.Repository;
|
||||||
import org.qortal.repository.RepositoryFactory;
|
import org.qortal.repository.RepositoryFactory;
|
||||||
|
import org.qortal.settings.Settings;
|
||||||
|
|
||||||
public class HSQLDBRepositoryFactory implements RepositoryFactory {
|
public class HSQLDBRepositoryFactory implements RepositoryFactory {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(HSQLDBRepositoryFactory.class);
|
private static final Logger LOGGER = LogManager.getLogger(HSQLDBRepositoryFactory.class);
|
||||||
private static final int POOL_SIZE = 100;
|
|
||||||
|
|
||||||
/** Log getConnection() calls that take longer than this. (ms) */
|
/** Log getConnection() calls that take longer than this. (ms) */
|
||||||
private static final long SLOW_CONNECTION_THRESHOLD = 1000L;
|
private static final long SLOW_CONNECTION_THRESHOLD = 1000L;
|
||||||
@ -57,7 +57,7 @@ public class HSQLDBRepositoryFactory implements RepositoryFactory {
|
|||||||
HSQLDBRepository.attemptRecovery(connectionUrl);
|
HSQLDBRepository.attemptRecovery(connectionUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.connectionPool = new HSQLDBPool(POOL_SIZE);
|
this.connectionPool = new HSQLDBPool(Settings.getInstance().getRepositoryConnectionPoolSize());
|
||||||
this.connectionPool.setUrl(this.connectionUrl);
|
this.connectionPool.setUrl(this.connectionUrl);
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
|
@ -136,6 +136,8 @@ public class Settings {
|
|||||||
private Long slowQueryThreshold = null;
|
private Long slowQueryThreshold = null;
|
||||||
/** Repository storage path. */
|
/** Repository storage path. */
|
||||||
private String repositoryPath = "db";
|
private String repositoryPath = "db";
|
||||||
|
/** Repository connection pool size. Needs to be a bit bigger than maxNetworkThreadPoolSize */
|
||||||
|
private int repositoryConnectionPoolSize = 100;
|
||||||
|
|
||||||
// Auto-update sources
|
// Auto-update sources
|
||||||
private String[] autoUpdateRepos = new String[] {
|
private String[] autoUpdateRepos = new String[] {
|
||||||
@ -430,6 +432,10 @@ public class Settings {
|
|||||||
return this.repositoryPath;
|
return this.repositoryPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRepositoryConnectionPoolSize() {
|
||||||
|
return this.repositoryConnectionPoolSize;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isAutoUpdateEnabled() {
|
public boolean isAutoUpdateEnabled() {
|
||||||
return this.autoUpdateEnabled;
|
return this.autoUpdateEnabled;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user