forked from Limework/skript-db
		
	remove thread pool config option & Use CachedThreadPool to make sure all threads are used properly
CachedThreadPool automatically creates threads on demand and automatically deletes unused threads after 60 seconds of no usage, so we can remove config option
This commit is contained in:
		
							parent
							
								
									05554a0043
								
							
						
					
					
						commit
						5a22864650
					
				@ -73,10 +73,6 @@ 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 mysql 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() + 1) + "\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");
 | 
				
			||||||
 | 
				
			|||||||
@ -51,7 +51,7 @@ public class EffExecuteStatement extends Effect {
 | 
				
			|||||||
  static String lastError;
 | 
					  static String lastError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private static final ExecutorService threadPool =
 | 
					  private static final ExecutorService threadPool =
 | 
				
			||||||
      Executors.newFixedThreadPool(SkriptDB.getInstance().getConfig().getInt("thread-pool-size", 2));
 | 
					      Executors.newCachedThreadPool();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private Expression<String> query;
 | 
					  private Expression<String> query;
 | 
				
			||||||
  private Expression<HikariDataSource> dataSource;
 | 
					  private Expression<HikariDataSource> dataSource;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user