since server area is gone it fetches some messages from hlstats now, will increase amount later, only potentially issue left is a nullpointer in getresponsemsg if none within 8 is reached, removed pipelines with annotation caching,
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package DataLayer;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author install1
|
||||
*/
|
||||
public class DBCPDataSourceHLstats {
|
||||
|
||||
private static BasicDataSource ds = new BasicDataSource();
|
||||
static {
|
||||
try {
|
||||
ds.setDriver(new com.mysql.cj.jdbc.Driver());
|
||||
ds.setUrl("jdbc:mysql://151.80.230.149:3306/unloze_stats?useLegacyDatetimeCode=false&serverTimezone=UTC");
|
||||
ds.setUsername("unloze_stats");
|
||||
ds.setPassword("R8J8E9Fzmcc7ZfDAGAk7");
|
||||
ds.setMaxTotal(-1);
|
||||
ds.setMinIdle(5);
|
||||
ds.setMaxIdle(-1);
|
||||
ds.setMaxOpenPreparedStatements(100);
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(DBCPDataSource.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static Connection getConnection() throws SQLException {
|
||||
return ds.getConnection();
|
||||
}
|
||||
|
||||
private DBCPDataSourceHLstats() {
|
||||
}
|
||||
}
|
||||
@@ -179,6 +179,24 @@ public class DataMapper {
|
||||
return LHMSMX;
|
||||
}
|
||||
|
||||
public static ConcurrentMap<Integer, String> getHLstatsMessages() {
|
||||
ConcurrentMap<Integer, String> hlStatsMessages = new MapMaker().concurrencyLevel(2).makeMap();
|
||||
try (Connection l_cCon = DBCPDataSourceHLstats.getConnection()) {
|
||||
String l_sSQL = "SELECT message FROM `hlstats_Events_Chat`";
|
||||
try (PreparedStatement l_pStatement = l_cCon.prepareStatement(l_sSQL, java.sql.ResultSet.TYPE_FORWARD_ONLY,
|
||||
java.sql.ResultSet.CONCUR_READ_ONLY)) {
|
||||
try (ResultSet l_rsSearch = l_pStatement.executeQuery()) {
|
||||
while (l_rsSearch.next()) {
|
||||
hlStatsMessages.put(hlStatsMessages.size() + 1, l_rsSearch.getString(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(DataMapper.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return hlStatsMessages;
|
||||
}
|
||||
|
||||
public static void CloseConnections(PreparedStatement ps, ResultSet rs, Connection con) {
|
||||
if (rs != null) {
|
||||
try {
|
||||
@@ -202,5 +220,4 @@ public class DataMapper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user