Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr committed Oct 8, 2023
1 parent 223c9ab commit 13600ea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,10 @@ public <T> void insertAll(Iterable<? extends T> documents) {
documents.forEach(document -> batchWriteDataList.add(getBatchWriteForInsert(document)));

List<BatchRecord> batchWriteRecords = batchWriteDataList.stream().map(BatchWriteData::batchRecord).toList();
RuntimeException re = null;
try {
client.operate(null, batchWriteRecords);
} catch (AerospikeException e) {
re = translateError(e);
throw translateError(e);
}

checkForErrorsAndUpdateVersion(batchWriteDataList, batchWriteRecords, "insert");
Expand Down Expand Up @@ -361,11 +360,10 @@ public <T> void updateAll(Iterable<T> documents) {
documents.forEach(document -> batchWriteDataList.add(getBatchWriteForUpdate(document)));

List<BatchRecord> batchWriteRecords = batchWriteDataList.stream().map(BatchWriteData::batchRecord).toList();
RuntimeException re = null;
try {
client.operate(null, batchWriteRecords);
} catch (AerospikeException e) {
re = translateError(e);
throw translateError(e);
}

checkForErrorsAndUpdateVersion(batchWriteDataList, batchWriteRecords, "update");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,5 +425,4 @@ public <T> BatchWriteData<T> getBatchWriteForUpdate(T document) {
protected boolean batchRecordFailed(BatchRecord batchRecord) {
return batchRecord.resultCode != ResultCode.OK || batchRecord.record == null;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.springframework.data.aerospike.utility;

import com.aerospike.client.AerospikeException;
import com.aerospike.client.Bin;
import com.aerospike.client.IAerospikeClient;
import com.aerospike.client.Key;
Expand All @@ -16,7 +17,6 @@
import lombok.SneakyThrows;
import lombok.Value;
import org.awaitility.Awaitility;
import org.springframework.dao.RecoverableDataAccessException;
import org.springframework.data.aerospike.core.WritePolicyBuilder;
import org.springframework.data.aerospike.index.IndexesCacheRefresher;
import org.springframework.data.aerospike.query.cache.IndexInfoParser;
Expand Down Expand Up @@ -167,7 +167,7 @@ public <T> void deleteAll(AerospikeRepository<T, ?> repository, Collection<T> en
if (ServerVersionUtils.isBatchWriteSupported(client)) {
try {
repository.deleteAll(entities);
} catch (RecoverableDataAccessException ignored) {
} catch (AerospikeException.BatchRecordArray ignored) {
// KEY_NOT_FOUND ResultCode causes exception if there are no entities
}
} else {
Expand Down

0 comments on commit 13600ea

Please sign in to comment.