forked from Limework/skript-db
Re-add thread-pool-size config option, fixes #19
This commit is contained in:
parent
eb89699ed5
commit
8586aeefcd
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.btk5h</groupId>
|
<groupId>com.btk5h</groupId>
|
||||||
<artifactId>skript-db</artifactId>
|
<artifactId>skript-db</artifactId>
|
||||||
<version>1.3.8</version>
|
<version>1.3.9</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
@ -73,6 +73,10 @@ public final class SkriptDB extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (out == null) return;
|
if (out == null) return;
|
||||||
|
|
||||||
|
out.write("# How many connections can be awaited for simultaneously, may be useful to increase if SQL database is hosted on a separate machine to account for ping.\n");
|
||||||
|
out.write("# If it is hosted within the same machine, set it to the count of cores your processor has or the count of threads your processor can process at once.\n");
|
||||||
|
out.write("thread-pool-size: " + (Runtime.getRuntime().availableProcessors() + 2) + "\n");
|
||||||
out.write("# Only change this if you wish to use a different driver than Java's default, like MariaDB driver.\n");
|
out.write("# Only change this if you wish to use a different driver than Java's default, like MariaDB driver.\n");
|
||||||
out.write("# If you use MariaDB, its driver is shaded together with skript-db, so you can just specify:" + "\"org.mariadb.jdbc.Driver\"" + ".\n");
|
out.write("# If you use MariaDB, its driver is shaded together with skript-db, so you can just specify:" + "\"org.mariadb.jdbc.Driver\"" + ".\n");
|
||||||
out.write("sql-driver-class-name: " + "\"default\"" + "\n");
|
out.write("sql-driver-class-name: " + "\"default\"" + "\n");
|
||||||
|
@ -44,8 +44,7 @@ import java.util.concurrent.Executors;
|
|||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
*/
|
*/
|
||||||
public class EffExecuteStatement extends Effect {
|
public class EffExecuteStatement extends Effect {
|
||||||
private static final ExecutorService threadPool =
|
private static final ExecutorService threadPool = Executors.newFixedThreadPool(SkriptDB.getInstance().getConfig().getInt("thread-pool-size", 10));
|
||||||
Executors.newCachedThreadPool();
|
|
||||||
static String lastError;
|
static String lastError;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -55,7 +55,7 @@ public class ExprDataSource extends SimpleExpression<HikariDataSource> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HikariDataSource ds = new HikariDataSource();
|
HikariDataSource ds = new HikariDataSource();
|
||||||
|
ds.setMaximumPoolSize(SkriptDB.getInstance().getConfig().getInt("thread-pool-size", 10));
|
||||||
//allow specifying of own sql driver class name
|
//allow specifying of own sql driver class name
|
||||||
if (!SkriptDB.getInstance().getConfig().getString("sql-driver-class-name", "default").equals("default")) {
|
if (!SkriptDB.getInstance().getConfig().getString("sql-driver-class-name", "default").equals("default")) {
|
||||||
ds.setDriverClassName(SkriptDB.getInstance().getConfig().getString("sql-driver-class-name"));
|
ds.setDriverClassName(SkriptDB.getInstance().getConfig().getString("sql-driver-class-name"));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: skript-db
|
name: skript-db
|
||||||
version: 1.3.5
|
version: 1.3.9
|
||||||
main: com.btk5h.skriptdb.SkriptDB
|
main: com.btk5h.skriptdb.SkriptDB
|
||||||
depend: [Skript]
|
depend: [Skript]
|
||||||
authors: [btk5h, FranKusmiruk, Govindas, TPGamesNL]
|
authors: [btk5h, FranKusmiruk, Govindas, TPGamesNL]
|
||||||
|
Loading…
Reference in New Issue
Block a user