Experimental DB pool + fixed stat overflow on equips

Implemented EXPERIMENTAL DBCP (connection pool), trying to improve
concorrent access to DB. Added door portals on Kerning Square. Fixed
equipments getting stat overflow when upgrading stats. Fixed expiring
pets crashing the client in some cases.
This commit is contained in:
ronancpl
2017-08-23 18:01:17 -03:00
parent 36db21bf80
commit 6628e3db54
190 changed files with 18265 additions and 2183 deletions

View File

@@ -23,8 +23,10 @@ package server.maps;
import java.awt.Point;
import java.awt.Rectangle;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
@@ -168,7 +170,9 @@ public class MapleMapFactory {
map.addMapleArea(new Rectangle(x1, y1, (x2 - x1), (y2 - y1)));
}
}
try { try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM playernpcs WHERE map = ?")) {
try {
Connection con = DatabaseConnection.getConnection();
try (PreparedStatement ps = con.prepareStatement("SELECT * FROM playernpcs WHERE map = ?")) {
ps.setInt(1, omapid);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
@@ -176,7 +180,9 @@ public class MapleMapFactory {
}
}
}
} catch (Exception e) {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}