mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-25 02:28:54 +00:00
连接池线程安全修正
This commit is contained in:
parent
7a74e88cd1
commit
ccedc8cfea
@ -4,7 +4,7 @@ import java.sql.Connection;
|
|||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
public class MySQLCore implements DatabaseCore {
|
public class MySQLCore implements DatabaseCore {
|
||||||
@ -12,7 +12,7 @@ public class MySQLCore implements DatabaseCore {
|
|||||||
/** The connection properties... user, pass, autoReconnect.. */
|
/** The connection properties... user, pass, autoReconnect.. */
|
||||||
private Properties info;
|
private Properties info;
|
||||||
private static final int MAX_CONNECTIONS = 8;
|
private static final int MAX_CONNECTIONS = 8;
|
||||||
private static ArrayList<Connection> pool = new ArrayList<>();
|
private static final List<Connection> pool = Collections.synchronizedList(new ArrayList<Connection>());
|
||||||
|
|
||||||
public MySQLCore(String host, String user, String pass, String database, String port) {
|
public MySQLCore(String host, String user, String pass, String database, String port) {
|
||||||
info = new Properties();
|
info = new Properties();
|
||||||
|
Loading…
Reference in New Issue
Block a user