Refactored DatabaseFactory.
This commit is contained in:
@@ -33,7 +33,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.model.clan.entry.PledgeApplicantInfo;
|
||||
import com.l2jmobius.gameserver.model.clan.entry.PledgeRecruitInfo;
|
||||
@@ -91,7 +91,7 @@ public class ClanEntryManager
|
||||
|
||||
private final void load()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT * FROM pledge_recruit"))
|
||||
{
|
||||
@@ -106,7 +106,7 @@ public class ClanEntryManager
|
||||
_log.warning(getClass().getSimpleName() + ": Exception: ClanEntryManager.load(): " + e.getMessage());
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT a.char_id, a.karma, b.base_class, b.level, b.char_name FROM pledge_waiting_list as a LEFT JOIN characters as b ON a.char_id = b.charId"))
|
||||
{
|
||||
@@ -122,7 +122,7 @@ public class ClanEntryManager
|
||||
_log.warning(getClass().getSimpleName() + ": Exception: ClanEntryManager.load(): " + e.getMessage());
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT a.charId, a.clanId, a.karma, a.message, b.base_class, b.level, b.char_name FROM pledge_applicant as a LEFT JOIN characters as b ON a.charId = b.charId"))
|
||||
{
|
||||
@@ -168,7 +168,7 @@ public class ClanEntryManager
|
||||
{
|
||||
final Map<Integer, PledgeApplicantInfo> clanApplicantList = _applicantList.get(clanId);
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_APPLICANT))
|
||||
{
|
||||
statement.setInt(1, playerId);
|
||||
@@ -189,7 +189,7 @@ public class ClanEntryManager
|
||||
{
|
||||
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
|
||||
{
|
||||
statement.setInt(1, info.getPlayerId());
|
||||
@@ -216,7 +216,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (!_playerLocked.containsKey(playerId))
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
|
||||
{
|
||||
statement.setInt(1, info.getPlayerId());
|
||||
@@ -237,7 +237,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (_waitingList.containsKey(playerId))
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
|
||||
{
|
||||
statement.setInt(1, playerId);
|
||||
@@ -258,7 +258,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, info.getClanId());
|
||||
@@ -280,7 +280,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, info.getKarma());
|
||||
@@ -302,7 +302,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (_clanList.containsKey(clanId))
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, clanId);
|
||||
|
Reference in New Issue
Block a user