removed thread pool again and hopefully deleting works as intended now
This commit is contained in:
parent
7e9d830c42
commit
ede81ec857
@ -84,27 +84,26 @@ public class DataMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void checkStringsToDelete() {
|
public static void checkStringsToDelete() {
|
||||||
Connection l_cCon = null;
|
|
||||||
PreparedStatement l_pStatement = null;
|
PreparedStatement l_pStatement = null;
|
||||||
ResultSet l_rsSearch = null;
|
ResultSet l_rsSearch = null;
|
||||||
String CountSQL = "select count(*) from Sentences";
|
String CountSQL = "select count(*) from Sentences";
|
||||||
String l_sSQL = "delete from Sentences\n" +
|
String l_sSQL = "delete from Sentences order by last_used asc limit 5;";
|
||||||
" order by last_used asc limit 5";
|
try (Connection l_cCon = DBCPDataSource.getConnection()) {
|
||||||
try {
|
|
||||||
l_cCon = DBCPDataSource.getConnection();
|
|
||||||
l_pStatement = l_cCon.prepareStatement(CountSQL);
|
l_pStatement = l_cCon.prepareStatement(CountSQL);
|
||||||
ResultSet resultSet = l_pStatement.executeQuery();
|
ResultSet resultSet = l_pStatement.executeQuery();
|
||||||
if (resultSet.next()) {
|
if (resultSet.next()) {
|
||||||
int count = resultSet.getInt(1);
|
int count = resultSet.getInt(1);
|
||||||
if (count > 7000) {
|
if (count > 7000) {
|
||||||
|
//System.out.println("cleaning strings: " + l_sSQL);
|
||||||
l_pStatement = l_cCon.prepareStatement(l_sSQL);
|
l_pStatement = l_cCon.prepareStatement(l_sSQL);
|
||||||
l_pStatement.execute();
|
l_pStatement.executeUpdate();
|
||||||
|
l_cCon.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException throwables) {
|
} catch (SQLException throwables) {
|
||||||
throwables.printStackTrace();
|
throwables.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
CloseConnections(l_pStatement, l_rsSearch, l_cCon);
|
CloseConnections(l_pStatement, l_rsSearch, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,6 @@ public class DiscordHandler extends ListenerAdapter {
|
|||||||
private static Datahandler datahandler;
|
private static Datahandler datahandler;
|
||||||
private static StanfordCoreNLP stanfordCoreNLPSentiment;
|
private static StanfordCoreNLP stanfordCoreNLPSentiment;
|
||||||
private static ExecutorService executorService = Executors.newFixedThreadPool(1);
|
private static ExecutorService executorService = Executors.newFixedThreadPool(1);
|
||||||
private static ExecutorService executorServiceResponse = Executors.newFixedThreadPool(2);
|
|
||||||
private static ExecutorService executorServiceIngame = Executors.newFixedThreadPool(2);
|
private static ExecutorService executorServiceIngame = Executors.newFixedThreadPool(2);
|
||||||
|
|
||||||
//TODO add python program that edits the java code. python program just adds test if statements on
|
//TODO add python program that edits the java code. python program just adds test if statements on
|
||||||
@ -169,17 +168,12 @@ public class DiscordHandler extends ListenerAdapter {
|
|||||||
}
|
}
|
||||||
if (mentionedBot || channelName.contains("general-autism")) {
|
if (mentionedBot || channelName.contains("general-autism")) {
|
||||||
final String contentF = content;
|
final String contentF = content;
|
||||||
executorServiceResponse.execute(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
String ResponseStr = datahandler.getResponseMsg(contentF, username, stanfordCoreNLP, stanfordCoreNLPSentiment,
|
String ResponseStr = datahandler.getResponseMsg(contentF, username, stanfordCoreNLP, stanfordCoreNLPSentiment,
|
||||||
false);
|
false);
|
||||||
if (!ResponseStr.isEmpty()) {
|
if (!ResponseStr.isEmpty()) {
|
||||||
System.out.print("\nResponseStr3: " + ResponseStr + "\n");
|
System.out.print("\nResponseStr3: " + ResponseStr + "\n");
|
||||||
event.getMessage().getChannel().sendMessage(ResponseStr).queue();
|
event.getMessage().getChannel().sendMessage(ResponseStr).queue();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
final String contentF = content;
|
final String contentF = content;
|
||||||
executorService.execute(new Runnable() {
|
executorService.execute(new Runnable() {
|
||||||
|
Loading…
Reference in New Issue
Block a user