public void deleteRecipientData(RecipientId recipientId) {
logger.debug("Deleting recipient data for {}", recipientId);
synchronized (recipientsLock) {
- recipientAddressCache.entrySet()
- .stream()
- .filter(e -> e.getValue().id().equals(recipientId))
- .forEach(e -> recipientAddressCache.remove(e.getKey()));
+ recipientAddressCache.entrySet().removeIf(e -> e.getValue().id().equals(recipientId));
try (final var connection = database.getConnection()) {
connection.setAutoCommit(false);
storeContact(connection, recipientId, null);
recipientMergeHandler.mergeRecipients(connection, pair.first(), toBeMergedRecipientId);
deleteRecipient(connection, toBeMergedRecipientId);
synchronized (recipientsLock) {
- recipientAddressCache.entrySet()
- .stream()
- .filter(e -> e.getValue().id().equals(toBeMergedRecipientId))
- .forEach(e -> recipientAddressCache.remove(e.getKey()));
+ recipientAddressCache.entrySet().removeIf(e -> e.getValue().id().equals(toBeMergedRecipientId));
}
}
} catch (SQLException e) {
private void removeRecipientAddress(Connection connection, RecipientId recipientId) throws SQLException {
synchronized (recipientsLock) {
- recipientAddressCache.entrySet()
- .stream()
- .filter(e -> e.getValue().id().equals(recipientId))
- .forEach(e -> recipientAddressCache.remove(e.getKey()));
+ recipientAddressCache.entrySet().removeIf(e -> e.getValue().id().equals(recipientId));
final var sql = (
"""
UPDATE %s
Connection connection, RecipientId recipientId, final RecipientAddress address
) throws SQLException {
synchronized (recipientsLock) {
- recipientAddressCache.entrySet()
- .stream()
- .filter(e -> e.getValue().id().equals(recipientId))
- .forEach(e -> recipientAddressCache.remove(e.getKey()));
+ recipientAddressCache.entrySet().removeIf(e -> e.getValue().id().equals(recipientId));
final var sql = (
"""
UPDATE %s