Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AuditService {
- private CopyOnWriteArrayList<Audit> copyWrite;
- public void flush(Audit... audits) {
- Collection<Audit> auditCollection = Arrays.asList(audits);
- this.copyWrite.addAll(auditCollection);
- this.copyWrite.forEach(audit -> {
- try {
- // save audit object on database
- this.copyWrite.remove(audit);
- } catch (DataAccessException e) {
- // log it
- }
- });
- }
- }
Add Comment
Please, Sign In to add comment