From b87560a1e50e25e7fd507a1740d356f773180164 Mon Sep 17 00:00:00 2001 From: chandrasegar Date: Thu, 29 Feb 2024 14:39:35 +0530 Subject: [PATCH] lines formatted --- src/main/java/entgra/mailsender/DAO/Impl/MailDAOImpl.java | 8 ++++++-- .../java/entgra/mailsender/util/PriorityQueueHolder.java | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/entgra/mailsender/DAO/Impl/MailDAOImpl.java b/src/main/java/entgra/mailsender/DAO/Impl/MailDAOImpl.java index fa17d3d..2e3c2c8 100644 --- a/src/main/java/entgra/mailsender/DAO/Impl/MailDAOImpl.java +++ b/src/main/java/entgra/mailsender/DAO/Impl/MailDAOImpl.java @@ -45,7 +45,9 @@ public class MailDAOImpl implements MailDAO { try { PreparedStatement stmt; Connection conn = dataSource.getConnection(); - stmt = conn.prepareStatement("INSERT INTO EMAIL (EMAIL_ADDRESS, MSG_TEMPLATE, PRIORITY, ATTACHMENT, PARAMETERS, TIME, FILENAME, EXPIRY_AT,UUID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", PreparedStatement.RETURN_GENERATED_KEYS); + stmt = conn.prepareStatement("INSERT INTO EMAIL (EMAIL_ADDRESS, MSG_TEMPLATE, PRIORITY, ATTACHMENT," + + " PARAMETERS, TIME, FILENAME, EXPIRY_AT,UUID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", + PreparedStatement.RETURN_GENERATED_KEYS); Timestamp current_time = new Timestamp(System.currentTimeMillis()); String parametersJson = new ObjectMapper().writeValueAsString(mailModel.getParameters()); stmt.setString(1, mailModel.getEmailAddress()); @@ -86,7 +88,8 @@ public class MailDAOImpl implements MailDAO { @Override public List getUnsentMessages() { - 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)"; + 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)"; List unsentMails = new ArrayList<>(); @@ -171,6 +174,7 @@ public class MailDAOImpl implements MailDAO { outputStream.write(buffer); } } catch (IOException e) { + logger.info(e.getMessage()); throw new FileConversionException("Error converting Blob to File", e); } return file; diff --git a/src/main/java/entgra/mailsender/util/PriorityQueueHolder.java b/src/main/java/entgra/mailsender/util/PriorityQueueHolder.java index 899c20e..af47e5f 100644 --- a/src/main/java/entgra/mailsender/util/PriorityQueueHolder.java +++ b/src/main/java/entgra/mailsender/util/PriorityQueueHolder.java @@ -18,7 +18,8 @@ public class PriorityQueueHolder { @Getter private final AtomicLong insertionOrderCounter = new AtomicLong(1); - // PriorityBlockingQueue is thread-safe and supports ordering elements based on their natural order or a custom comparator. + // PriorityBlockingQueue is thread-safe and supports ordering elements based on their natural order or a + //custom comparator. @Getter private final BlockingQueue priorityQueue = new PriorityBlockingQueue<>(100, Comparator .comparingLong(MailModel::getPriority) -- 2.36.3