Compare commits

..

No commits in common. '3b62e5016cca9ac6008871a16bf23fa1903ca92a' and '927a082e634f836300d1177efa623af59310f374' have entirely different histories.

@ -45,9 +45,7 @@ public class MailDAOImpl implements MailDAO {
try { try {
PreparedStatement stmt; PreparedStatement stmt;
Connection conn = dataSource.getConnection(); Connection conn = dataSource.getConnection();
stmt = conn.prepareStatement("INSERT INTO EMAIL (EMAIL_ADDRESS, MSG_TEMPLATE, PRIORITY, ATTACHMENT," + stmt = conn.prepareStatement("INSERT INTO EMAIL (EMAIL_ADDRESS, MSG_TEMPLATE, PRIORITY, ATTACHMENT, PARAMETERS, TIME, FILENAME, EXPIRY_AT,UUID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", PreparedStatement.RETURN_GENERATED_KEYS);
" PARAMETERS, TIME, FILENAME, EXPIRY_AT,UUID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
PreparedStatement.RETURN_GENERATED_KEYS);
Timestamp current_time = new Timestamp(System.currentTimeMillis()); Timestamp current_time = new Timestamp(System.currentTimeMillis());
String parametersJson = new ObjectMapper().writeValueAsString(mailModel.getParameters()); String parametersJson = new ObjectMapper().writeValueAsString(mailModel.getParameters());
stmt.setString(1, mailModel.getEmailAddress()); stmt.setString(1, mailModel.getEmailAddress());
@ -88,8 +86,7 @@ public class MailDAOImpl implements MailDAO {
@Override @Override
public List<MailModel> getUnsentMessages() { public List<MailModel> getUnsentMessages() {
String sql = "SELECT E.* FROM EMAIL E LEFT JOIN SENTEMAIL SE ON E.UUID = SE.UUID WHERE SE.UUID IS NULL AND" + String sql = "SELECT E.* FROM EMAIL E LEFT JOIN SENTEMAIL SE ON E.UUID = SE.UUID WHERE SE.UUID IS NULL AND (E.EXPIRY_AT IS NULL OR E.EXPIRY_AT > CURRENT_DATE)";
"(E.EXPIRY_AT IS NULL OR E.EXPIRY_AT > CURRENT_DATE)";
List<MailModel> unsentMails = new ArrayList<>(); List<MailModel> unsentMails = new ArrayList<>();
@ -174,7 +171,6 @@ public class MailDAOImpl implements MailDAO {
outputStream.write(buffer); outputStream.write(buffer);
} }
} catch (IOException e) { } catch (IOException e) {
logger.info(e.getMessage());
throw new FileConversionException("Error converting Blob to File", e); throw new FileConversionException("Error converting Blob to File", e);
} }
return file; return file;

@ -18,8 +18,7 @@ public class PriorityQueueHolder {
@Getter @Getter
private final AtomicLong insertionOrderCounter = new AtomicLong(1); private final AtomicLong insertionOrderCounter = new AtomicLong(1);
// PriorityBlockingQueue is thread-safe and supports ordering elements based on their natural order or a // PriorityBlockingQueue is thread-safe and supports ordering elements based on their natural order or a custom comparator.
//custom comparator.
@Getter @Getter
private final BlockingQueue<MailModel> priorityQueue = new PriorityBlockingQueue<>(100, Comparator private final BlockingQueue<MailModel> priorityQueue = new PriorityBlockingQueue<>(100, Comparator
.comparingLong(MailModel::getPriority) .comparingLong(MailModel::getPriority)

Loading…
Cancel
Save