[FIX] Поддержка нового формата подключения PostgreSQL

This commit is contained in:
Zaxar163 2020-04-05 10:20:35 +03:00
parent 43a43ec30d
commit 3ed166f8e7
4 changed files with 9 additions and 10 deletions

2
.gitignore vendored
View file

@ -107,6 +107,6 @@ buildnumber
*.directory *.directory
cmd.bat cmd.bat
cmd.sh cmd.sh
project/target
## PVS Studio ## PVS Studio
.PVS-Studio/ .PVS-Studio/
project/target

View file

@ -21,8 +21,8 @@ public final class PostgreSQLSourceConfig implements AutoCloseable {
private String poolName; private String poolName;
// Config // Config
private String address; private String[] addresses;
private int port; private int[] ports;
private String username; private String username;
private String password; private String password;
private String database; private String database;
@ -43,8 +43,8 @@ public synchronized Connection getConnection() throws SQLException {
PGSimpleDataSource postgresqlSource = new PGSimpleDataSource(); PGSimpleDataSource postgresqlSource = new PGSimpleDataSource();
// Set credentials // Set credentials
postgresqlSource.setServerNames(new String[] {address}); //TODO support multinode PostgreSQL DB postgresqlSource.setServerNames(addresses);
postgresqlSource.setPortNumbers(new int[] {port}); postgresqlSource.setPortNumbers(ports);
postgresqlSource.setUser(username); postgresqlSource.setUser(username);
postgresqlSource.setPassword(password); postgresqlSource.setPassword(password);
postgresqlSource.setDatabaseName(database); postgresqlSource.setDatabaseName(database);

View file

@ -10,6 +10,7 @@
import java.net.Socket; import java.net.Socket;
import java.util.Set; import java.util.Set;
// TODO refactor
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class NettyServerSocketHandler implements Runnable, AutoCloseable { public final class NettyServerSocketHandler implements Runnable, AutoCloseable {
private SSLServerSocketFactory ssf; private SSLServerSocketFactory ssf;
@ -18,9 +19,6 @@ public final class NettyServerSocketHandler implements Runnable, AutoCloseable {
public LauncherNettyServer nettyServer; public LauncherNettyServer nettyServer;
// API
private Set<Socket> sockets;
private transient final LaunchServer server; private transient final LaunchServer server;
public NettyServerSocketHandler(LaunchServer server) { public NettyServerSocketHandler(LaunchServer server) {
@ -29,7 +27,8 @@ public NettyServerSocketHandler(LaunchServer server) {
@Override @Override
public void close() { public void close() {
//TODO: Close Impl nettyServer.close();
nettyServer.service.channels.close();
} }
@Override @Override

View file

@ -2,7 +2,7 @@
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false id 'com.github.johnrengelman.shadow' version '5.2.0' apply false
id 'maven-publish' id 'maven-publish'
id 'signing' id 'signing'
id 'org.openjfx.javafxplugin' version '0.0.7' apply false id 'org.openjfx.javafxplugin' version '0.0.8' apply false
} }
group = 'pro.gravit.launcher' group = 'pro.gravit.launcher'
version = '5.1.3' version = '5.1.3'