Use the same connection for all custom mail manager queries.
This commit is contained in:
parent
b0efc59d8c
commit
03bfff35d1
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -91,8 +91,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -105,13 +104,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
@ -92,8 +92,7 @@ public class CustomMailManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete entry from database.
|
// Delete entry from database.
|
||||||
try (Connection con2 = DatabaseFactory.getConnection();
|
try (PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
|
||||||
PreparedStatement stmt = con2.prepareStatement(DELETE_SQL))
|
|
||||||
{
|
{
|
||||||
stmt.setString(1, rs.getString("date"));
|
stmt.setString(1, rs.getString("date"));
|
||||||
stmt.setInt(2, playerId);
|
stmt.setInt(2, playerId);
|
||||||
@ -106,13 +105,13 @@ public class CustomMailManager
|
|||||||
|
|
||||||
// Send message.
|
// Send message.
|
||||||
MailManager.getInstance().sendMessage(msg);
|
MailManager.getInstance().sendMessage(msg);
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Sent message at " + player.getName() + ".");
|
LOGGER.info(getClass().getSimpleName() + ": Message sent to " + player.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error loading from database:", e);
|
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Error reading from database: ", e);
|
||||||
}
|
}
|
||||||
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
}, Config.CUSTOM_MAIL_MANAGER_DELAY, Config.CUSTOM_MAIL_MANAGER_DELAY);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user