Addition of missing DatabaseFactory initialization message.

This commit is contained in:
MobiusDev
2018-04-02 15:51:12 +00:00
parent c071f2a1bc
commit 0d3a422ee3
9 changed files with 48 additions and 33 deletions

View File

@@ -30,7 +30,7 @@ import com.mchange.v2.c3p0.ComboPooledDataSource;
*/ */
public class DatabaseFactory public class DatabaseFactory
{ {
private static final Logger _log = Logger.getLogger(DatabaseFactory.class.getName()); private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
private final ComboPooledDataSource _dataSource; private final ComboPooledDataSource _dataSource;
@@ -39,7 +39,7 @@ public class DatabaseFactory
if (Config.DATABASE_MAX_CONNECTIONS < 2) if (Config.DATABASE_MAX_CONNECTIONS < 2)
{ {
Config.DATABASE_MAX_CONNECTIONS = 2; Config.DATABASE_MAX_CONNECTIONS = 2;
_log.warning("A minimum of 2 connections are required."); LOGGER.warning("A minimum of 2 connections are required.");
} }
_dataSource = new ComboPooledDataSource(); _dataSource = new ComboPooledDataSource();
@@ -92,6 +92,8 @@ public class DatabaseFactory
{ {
e.printStackTrace(); e.printStackTrace();
} }
LOGGER.info("Database: Initialized.");
} }
public Connection getConnection() public Connection getConnection()
@@ -105,7 +107,7 @@ public class DatabaseFactory
} }
catch (SQLException e) catch (SQLException e)
{ {
_log.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage()); LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
} }
} }
return con; return con;
@@ -119,7 +121,7 @@ public class DatabaseFactory
} }
catch (Exception e) catch (Exception e)
{ {
_log.info(e.getMessage()); LOGGER.info(e.getMessage());
} }
} }

View File

@@ -30,7 +30,7 @@ import com.mchange.v2.c3p0.ComboPooledDataSource;
*/ */
public class DatabaseFactory public class DatabaseFactory
{ {
private static final Logger _log = Logger.getLogger(DatabaseFactory.class.getName()); private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
private final ComboPooledDataSource _dataSource; private final ComboPooledDataSource _dataSource;
@@ -39,7 +39,7 @@ public class DatabaseFactory
if (Config.DATABASE_MAX_CONNECTIONS < 2) if (Config.DATABASE_MAX_CONNECTIONS < 2)
{ {
Config.DATABASE_MAX_CONNECTIONS = 2; Config.DATABASE_MAX_CONNECTIONS = 2;
_log.warning("A minimum of 2 connections are required."); LOGGER.warning("A minimum of 2 connections are required.");
} }
_dataSource = new ComboPooledDataSource(); _dataSource = new ComboPooledDataSource();
@@ -92,6 +92,8 @@ public class DatabaseFactory
{ {
e.printStackTrace(); e.printStackTrace();
} }
LOGGER.info("Database: Initialized.");
} }
public Connection getConnection() public Connection getConnection()
@@ -105,7 +107,7 @@ public class DatabaseFactory
} }
catch (SQLException e) catch (SQLException e)
{ {
_log.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage()); LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
} }
} }
return con; return con;
@@ -119,7 +121,7 @@ public class DatabaseFactory
} }
catch (Exception e) catch (Exception e)
{ {
_log.info(e.getMessage()); LOGGER.info(e.getMessage());
} }
} }

View File

@@ -30,7 +30,7 @@ import com.mchange.v2.c3p0.ComboPooledDataSource;
*/ */
public class DatabaseFactory public class DatabaseFactory
{ {
private static final Logger _log = Logger.getLogger(DatabaseFactory.class.getName()); private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
private final ComboPooledDataSource _dataSource; private final ComboPooledDataSource _dataSource;
@@ -39,7 +39,7 @@ public class DatabaseFactory
if (Config.DATABASE_MAX_CONNECTIONS < 2) if (Config.DATABASE_MAX_CONNECTIONS < 2)
{ {
Config.DATABASE_MAX_CONNECTIONS = 2; Config.DATABASE_MAX_CONNECTIONS = 2;
_log.warning("A minimum of 2 connections are required."); LOGGER.warning("A minimum of 2 connections are required.");
} }
_dataSource = new ComboPooledDataSource(); _dataSource = new ComboPooledDataSource();
@@ -92,6 +92,8 @@ public class DatabaseFactory
{ {
e.printStackTrace(); e.printStackTrace();
} }
LOGGER.info("Database: Initialized.");
} }
public Connection getConnection() public Connection getConnection()
@@ -105,7 +107,7 @@ public class DatabaseFactory
} }
catch (SQLException e) catch (SQLException e)
{ {
_log.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage()); LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
} }
} }
return con; return con;
@@ -119,7 +121,7 @@ public class DatabaseFactory
} }
catch (Exception e) catch (Exception e)
{ {
_log.info(e.getMessage()); LOGGER.info(e.getMessage());
} }
} }

View File

@@ -30,7 +30,7 @@ import com.mchange.v2.c3p0.ComboPooledDataSource;
*/ */
public class DatabaseFactory public class DatabaseFactory
{ {
private static final Logger _log = Logger.getLogger(DatabaseFactory.class.getName()); private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
private final ComboPooledDataSource _dataSource; private final ComboPooledDataSource _dataSource;
@@ -39,7 +39,7 @@ public class DatabaseFactory
if (Config.DATABASE_MAX_CONNECTIONS < 2) if (Config.DATABASE_MAX_CONNECTIONS < 2)
{ {
Config.DATABASE_MAX_CONNECTIONS = 2; Config.DATABASE_MAX_CONNECTIONS = 2;
_log.warning("A minimum of 2 connections are required."); LOGGER.warning("A minimum of 2 connections are required.");
} }
_dataSource = new ComboPooledDataSource(); _dataSource = new ComboPooledDataSource();
@@ -92,6 +92,8 @@ public class DatabaseFactory
{ {
e.printStackTrace(); e.printStackTrace();
} }
LOGGER.info("Database: Initialized.");
} }
public Connection getConnection() public Connection getConnection()
@@ -105,7 +107,7 @@ public class DatabaseFactory
} }
catch (SQLException e) catch (SQLException e)
{ {
_log.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage()); LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
} }
} }
return con; return con;
@@ -119,7 +121,7 @@ public class DatabaseFactory
} }
catch (Exception e) catch (Exception e)
{ {
_log.info(e.getMessage()); LOGGER.info(e.getMessage());
} }
} }

View File

@@ -30,7 +30,7 @@ import com.mchange.v2.c3p0.ComboPooledDataSource;
*/ */
public class DatabaseFactory public class DatabaseFactory
{ {
private static final Logger _log = Logger.getLogger(DatabaseFactory.class.getName()); private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
private final ComboPooledDataSource _dataSource; private final ComboPooledDataSource _dataSource;
@@ -39,7 +39,7 @@ public class DatabaseFactory
if (Config.DATABASE_MAX_CONNECTIONS < 2) if (Config.DATABASE_MAX_CONNECTIONS < 2)
{ {
Config.DATABASE_MAX_CONNECTIONS = 2; Config.DATABASE_MAX_CONNECTIONS = 2;
_log.warning("A minimum of 2 connections are required."); LOGGER.warning("A minimum of 2 connections are required.");
} }
_dataSource = new ComboPooledDataSource(); _dataSource = new ComboPooledDataSource();
@@ -87,6 +87,8 @@ public class DatabaseFactory
{ {
e.printStackTrace(); e.printStackTrace();
} }
LOGGER.info("Database: Initialized.");
} }
public Connection getConnection() public Connection getConnection()
@@ -100,7 +102,7 @@ public class DatabaseFactory
} }
catch (SQLException e) catch (SQLException e)
{ {
_log.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage()); LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
} }
} }
return con; return con;
@@ -114,7 +116,7 @@ public class DatabaseFactory
} }
catch (Exception e) catch (Exception e)
{ {
_log.info(e.getMessage()); LOGGER.info(e.getMessage());
} }
} }

View File

@@ -179,7 +179,6 @@ public class GameServer
Util.printSection("Database"); Util.printSection("Database");
DatabaseFactory.getInstance(); DatabaseFactory.getInstance();
LOGGER.info("Database: Initialized.");
Util.printSection("ThreadPool"); Util.printSection("ThreadPool");
ThreadPool.initThreadPools(new GameThreadPools()); ThreadPool.initThreadPools(new GameThreadPools());

View File

@@ -30,7 +30,7 @@ import com.mchange.v2.c3p0.ComboPooledDataSource;
*/ */
public class DatabaseFactory public class DatabaseFactory
{ {
private static final Logger _log = Logger.getLogger(DatabaseFactory.class.getName()); private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
private final ComboPooledDataSource _dataSource; private final ComboPooledDataSource _dataSource;
@@ -39,7 +39,7 @@ public class DatabaseFactory
if (Config.DATABASE_MAX_CONNECTIONS < 2) if (Config.DATABASE_MAX_CONNECTIONS < 2)
{ {
Config.DATABASE_MAX_CONNECTIONS = 2; Config.DATABASE_MAX_CONNECTIONS = 2;
_log.warning("A minimum of 2 connections are required."); LOGGER.warning("A minimum of 2 connections are required.");
} }
_dataSource = new ComboPooledDataSource(); _dataSource = new ComboPooledDataSource();
@@ -92,6 +92,8 @@ public class DatabaseFactory
{ {
e.printStackTrace(); e.printStackTrace();
} }
LOGGER.info("Database: Initialized.");
} }
public Connection getConnection() public Connection getConnection()
@@ -105,7 +107,7 @@ public class DatabaseFactory
} }
catch (SQLException e) catch (SQLException e)
{ {
_log.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage()); LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
} }
} }
return con; return con;
@@ -119,7 +121,7 @@ public class DatabaseFactory
} }
catch (Exception e) catch (Exception e)
{ {
_log.info(e.getMessage()); LOGGER.info(e.getMessage());
} }
} }

View File

@@ -30,7 +30,7 @@ import com.mchange.v2.c3p0.ComboPooledDataSource;
*/ */
public class DatabaseFactory public class DatabaseFactory
{ {
private static final Logger _log = Logger.getLogger(DatabaseFactory.class.getName()); private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
private final ComboPooledDataSource _dataSource; private final ComboPooledDataSource _dataSource;
@@ -39,7 +39,7 @@ public class DatabaseFactory
if (Config.DATABASE_MAX_CONNECTIONS < 2) if (Config.DATABASE_MAX_CONNECTIONS < 2)
{ {
Config.DATABASE_MAX_CONNECTIONS = 2; Config.DATABASE_MAX_CONNECTIONS = 2;
_log.warning("A minimum of 2 connections are required."); LOGGER.warning("A minimum of 2 connections are required.");
} }
_dataSource = new ComboPooledDataSource(); _dataSource = new ComboPooledDataSource();
@@ -92,6 +92,8 @@ public class DatabaseFactory
{ {
e.printStackTrace(); e.printStackTrace();
} }
LOGGER.info("Database: Initialized.");
} }
public Connection getConnection() public Connection getConnection()
@@ -105,7 +107,7 @@ public class DatabaseFactory
} }
catch (SQLException e) catch (SQLException e)
{ {
_log.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage()); LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
} }
} }
return con; return con;
@@ -119,7 +121,7 @@ public class DatabaseFactory
} }
catch (Exception e) catch (Exception e)
{ {
_log.info(e.getMessage()); LOGGER.info(e.getMessage());
} }
} }

View File

@@ -30,7 +30,7 @@ import com.mchange.v2.c3p0.ComboPooledDataSource;
*/ */
public class DatabaseFactory public class DatabaseFactory
{ {
private static final Logger _log = Logger.getLogger(DatabaseFactory.class.getName()); private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
private final ComboPooledDataSource _dataSource; private final ComboPooledDataSource _dataSource;
@@ -39,7 +39,7 @@ public class DatabaseFactory
if (Config.DATABASE_MAX_CONNECTIONS < 2) if (Config.DATABASE_MAX_CONNECTIONS < 2)
{ {
Config.DATABASE_MAX_CONNECTIONS = 2; Config.DATABASE_MAX_CONNECTIONS = 2;
_log.warning("A minimum of 2 connections are required."); LOGGER.warning("A minimum of 2 connections are required.");
} }
_dataSource = new ComboPooledDataSource(); _dataSource = new ComboPooledDataSource();
@@ -92,6 +92,8 @@ public class DatabaseFactory
{ {
e.printStackTrace(); e.printStackTrace();
} }
LOGGER.info("Database: Initialized.");
} }
public Connection getConnection() public Connection getConnection()
@@ -105,7 +107,7 @@ public class DatabaseFactory
} }
catch (SQLException e) catch (SQLException e)
{ {
_log.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage()); LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
} }
} }
return con; return con;
@@ -119,7 +121,7 @@ public class DatabaseFactory
} }
catch (Exception e) catch (Exception e)
{ {
_log.info(e.getMessage()); LOGGER.info(e.getMessage());
} }
} }