Minor refactoring for tool tasks
- Don't scan for translations on initialization in TranslationPageGenerator in order to speed up startup time of ToolsRunner - Extract checking for null / empty array of File#listFiles into a separate method - Move single method of RuntimeUtils into Utils class
This commit is contained in:
@@ -5,9 +5,6 @@ import com.zaxxer.hikari.HikariDataSource;
|
||||
import com.zaxxer.hikari.pool.HikariPool.PoolInitializationException;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.datasource.Columns;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.datasource.DataSourceType;
|
||||
import fr.xephi.authme.security.HashAlgorithm;
|
||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import fr.xephi.authme.security.crypts.XFBCRYPT;
|
||||
@@ -15,8 +12,8 @@ import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.util.RuntimeUtils;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
|
||||
import java.sql.Blob;
|
||||
import java.sql.Connection;
|
||||
@@ -100,8 +97,8 @@ public class MySQL implements DataSource {
|
||||
this.phpBbGroup = settings.getProperty(HooksSettings.PHPBB_ACTIVATED_GROUP_ID);
|
||||
this.wordpressPrefix = settings.getProperty(HooksSettings.WORDPRESS_TABLE_PREFIX);
|
||||
this.poolSize = settings.getProperty(DatabaseSettings.MYSQL_POOL_SIZE);
|
||||
if(poolSize == -1) {
|
||||
poolSize = RuntimeUtils.getCoreCount();
|
||||
if (poolSize == -1) {
|
||||
poolSize = Utils.getCoreCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package fr.xephi.authme.util;
|
||||
|
||||
/**
|
||||
* Runtime utilities.
|
||||
*/
|
||||
public class RuntimeUtils {
|
||||
|
||||
// Utility class
|
||||
private RuntimeUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the available core count of the JVM.
|
||||
*
|
||||
* @return the core count
|
||||
*/
|
||||
public static int getCoreCount() {
|
||||
return Runtime.getRuntime().availableProcessors();
|
||||
}
|
||||
}
|
||||
@@ -48,4 +48,13 @@ public final class Utils {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the available core count of the JVM.
|
||||
*
|
||||
* @return the core count
|
||||
*/
|
||||
public static int getCoreCount() {
|
||||
return Runtime.getRuntime().availableProcessors();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user