IMDG log improved on 'More than one element found...'

This commit is contained in:
ialbert 2023-08-01 16:43:56 +03:00
parent 241f88199d
commit d0eef0b15f
2 changed files with 4 additions and 4 deletions

View file

@ -155,7 +155,7 @@ public class ImdgHazelcast<T extends SpcexObjectBase> implements Imdg<T> {
Predicate<Long, T> and = Predicates.and(predicates);
Set<Map.Entry<Long, T>> found = map.entrySet(and);
if (found.size() > 1) {
throw new RuntimeException("More than one element found by predicate " + and + " - " + found.size());
throw new RuntimeException("More than one element found by predicate [" + and + "] - " + found.size());
}
Iterator<Map.Entry<Long, T>> allFoundByCondition = found.iterator();
if (allFoundByCondition.hasNext()) {
@ -180,7 +180,7 @@ public class ImdgHazelcast<T extends SpcexObjectBase> implements Imdg<T> {
SqlPredicate sqlPredicate = new SqlPredicate(paramString);
Set<Map.Entry<Long, T>> found = map.entrySet(sqlPredicate);
if (found.size() > 1) {
throw new RuntimeException("More than one element found by predicate " + paramString + " - " + found.size());
throw new RuntimeException("More than one element found by predicate [" + paramString + "] - " + found.size());
}
Iterator<Map.Entry<Long, T>> allFoundByCondition = found.iterator();
if (allFoundByCondition.hasNext()) {
@ -291,7 +291,7 @@ public class ImdgHazelcast<T extends SpcexObjectBase> implements Imdg<T> {
public T getSingleObjectByPredicate(ImdgPredicate predicate) {
Collection<T> els = getCollectionObjectsByPredicate(predicate);
if (els.size() > 1) {
throw new RuntimeException("More than one element found by predicate - " + els.size());
throw new RuntimeException("More than one element found by predicate [" + predicate + "] - " + els.size());
}
return els.size() == 1 ? els.iterator().next() : null;
}

View file

@ -106,7 +106,7 @@ public class ImdgTransactionalHazelcast<T extends SpcexObjectBase> implements Im
SqlPredicate sqlPredicate = new SqlPredicate(paramString);
Set<Long> found = map.keySet(sqlPredicate);
if (found.size() > 1) {
throw new RuntimeException("More than one element found by predicate " + paramString + " - " + found.size());
throw new RuntimeException("More than one element found by predicate [" + paramString + "] - " + found.size());
}
Iterator<Long> allFoundByCondition = found.iterator();
if (allFoundByCondition.hasNext()) {