mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-12 21:54:02 +01:00
Closes 2 not-closed sets
Add error-handling if the processor wasn't added into the Queue
This commit is contained in:
parent
a5d90f092d
commit
68f8159027
@ -195,7 +195,7 @@ public class CommandUseTable extends Table {
|
|||||||
|
|
||||||
public Optional<String> getCommandByID(int id) throws SQLException {
|
public Optional<String> getCommandByID(int id) throws SQLException {
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
ResultSet set;
|
ResultSet set = null;
|
||||||
try {
|
try {
|
||||||
statement = prepareStatement(Select.from(tableName, columnCommand).where(columnCommandId + "=?").toString());
|
statement = prepareStatement(Select.from(tableName, columnCommand).where(columnCommandId + "=?").toString());
|
||||||
statement.setInt(1, id);
|
statement.setInt(1, id);
|
||||||
@ -206,13 +206,13 @@ public class CommandUseTable extends Table {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
} finally {
|
} finally {
|
||||||
endTransaction(statement);
|
endTransaction(statement);
|
||||||
close(statement);
|
close(set, statement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Integer> getCommandID(String command) throws SQLException {
|
public Optional<Integer> getCommandID(String command) throws SQLException {
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
ResultSet set;
|
ResultSet set = null;
|
||||||
try {
|
try {
|
||||||
statement = prepareStatement(Select.from(tableName, columnCommandId).where(columnCommand + "=?").toString());
|
statement = prepareStatement(Select.from(tableName, columnCommandId).where(columnCommand + "=?").toString());
|
||||||
statement.setString(1, command);
|
statement.setString(1, command);
|
||||||
@ -223,7 +223,7 @@ public class CommandUseTable extends Table {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
} finally {
|
} finally {
|
||||||
endTransaction(statement);
|
endTransaction(statement);
|
||||||
close(statement);
|
close(set, statement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,9 @@ public class ProcessingQueue extends Queue<Processor> {
|
|||||||
* @param processor processing object.
|
* @param processor processing object.
|
||||||
*/
|
*/
|
||||||
public void addToQueue(Processor processor) {
|
public void addToQueue(Processor processor) {
|
||||||
queue.offer(processor);
|
if (!queue.offer(processor)) {
|
||||||
|
Log.toLog("ProcessingQueue.addToQueue", new IllegalStateException("Processor was not added to Queue"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user