[FEATURE] Поддержка HikariCP в HibernateDAO

This commit is contained in:
Gravit 2020-09-08 21:09:15 +07:00
parent 996d126611
commit 383551229d
No known key found for this signature in database
GPG key ID: 98A079490768CCE5
3 changed files with 34 additions and 1 deletions

View file

@ -80,6 +80,7 @@ pack project(':LauncherAPI')
bundle group: 'org.slf4j', name: 'slf4j-simple', version: rootProject['verSlf4j']
bundle group: 'org.slf4j', name: 'slf4j-api', version: rootProject['verSlf4j']
bundle group: 'org.hibernate', name: 'hibernate-core', version: rootProject['verHibernate']
bundle group: 'org.hibernate', name: 'hibernate-hikaricp', version: rootProject['verHibernate']
bundle group: 'mysql', name: 'mysql-connector-java', version: rootProject['verMySQLConn']
bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn']
bundle group: 'net.sf.proguard', name: 'proguard-base', version: rootProject['verProguard']

View file

@ -1,10 +1,14 @@
package pro.gravit.launchserver.command.basic;
import org.bouncycastle.cert.X509CertificateHolder;
import pro.gravit.launcher.request.auth.password.AuthPlainPassword;
import pro.gravit.launchserver.LaunchServer;
import pro.gravit.launchserver.auth.AuthException;
import pro.gravit.launchserver.auth.AuthProviderPair;
import pro.gravit.launchserver.command.Command;
import pro.gravit.launchserver.socket.handlers.NettyServerSocketHandler;
import pro.gravit.utils.helper.CommonHelper;
import pro.gravit.utils.helper.LogHelper;
import java.nio.file.Paths;
import java.security.KeyPair;
@ -54,5 +58,33 @@ public void invoke(String... args) throws Exception {
server.certificateManager.writePrivateKey(Paths.get(name.concat(".key")), pair.getPrivate());
server.certificateManager.writeCertificate(Paths.get(name.concat(".crt")), cert);
}
if(args[0].equals("authstresser"))
{
AuthProviderPair pair = server.config.getAuthProviderPair();
AuthPlainPassword plainPassword = new AuthPlainPassword("test");
Runnable runnable = () -> {
long startTime = System.currentTimeMillis();
for(int i=0;i<100000;++i)
{
try {
pair.provider.auth("Test", plainPassword, "127.0.0.1");
} catch (AuthException ignored)
{
} catch (Exception e) {
throw new RuntimeException(e);
}
if((i % 10000) == 0)
{
LogHelper.info("Completed %d requests", i);
}
}
LogHelper.info("Completed all requests. Time %d ms", System.currentTimeMillis() - startTime);
};
for(int i=0;i<7;++i)
{
CommonHelper.newThread(String.format("Stresser #%d", i), true, runnable).start();
}
}
}
}

View file

@ -14,5 +14,5 @@
verPostgreSQLConn = '42.2.11'
verProguard = '6.2.2'
verLaunch4j = '3.12'
verHibernate = '5.4.12.Final'
verHibernate = '5.4.21.Final'
}