diff --git a/haiti-bom/pom.xml b/haiti-bom/pom.xml deleted file mode 100644 index 08587a5..0000000 --- a/haiti-bom/pom.xml +++ /dev/null @@ -1,262 +0,0 @@ - - - 4.0.0 - - dev.struchkov.haiti - haiti-bom - 1.5.0 - pom - - Haiti Dependencies - Current versions of the framework dependencies - https://github.com/haiti-projects/haiti-framework - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0 - - - - GitHub - https://github.com/haiti-projects/haiti-framework/issues - - - - 11 - ${java.version} - ${java.version} - UTF-8 - UTF-8 - - ${project.version} - - ${haiti.ver} - ${haiti.ver} - ${haiti.ver} - ${haiti.ver} - ${haiti.ver} - - 1.4.0 - 0.0.4 - - 0.0.4 - 0.0.5 - - 4.3.1 - 2.6.1 - 2.6.1 - - 5.6.4.Final - 2.2 - 7.16.3 - 1.7.33 - 1.0.1 - 23.0.0 - - 3.10.1 - 1.6.13 - 3.2.1 - 3.4.0 - 3.0.1 - - - - - - dev.struchkov.haiti - haiti-exception - ${haiti.exception.ver} - - - dev.struchkov.haiti - haiti-context - ${haiti.context.ver} - - - dev.struchkov.haiti - haiti-core - ${haiti.core.ver} - - - dev.struchkov.haiti - haiti-filter - ${haiti.filter.api.ver} - - - dev.struchkov.haiti.filter - haiti-filter-criteria - ${haiti.filter.criteria.ver} - - - dev.struchkov.haiti - haiti-utils - ${haiti.utils.ver} - - - dev.struchkov.haiti.utils - haiti-utils-network - ${haiti.utils.network.ver} - - - dev.struchkov.haiti.data - haiti-database - ${haiti.database.ver} - - - - org.elasticsearch - elasticsearch - ${elasticsearch.ver} - - - - javax.persistence - javax.persistence-api - ${javax.persisttence.api.ver} - - - - - org.springframework.data - spring-data-elasticsearch - ${spring.data.elasticsearch.ver} - - - - org.springframework.data - spring-data-commons - ${spring.data.commons.ver} - - - - org.springframework.data - spring-data-jpa - ${spring.data.jpa.ver} - - - - org.slf4j - slf4j-api - ${slf4j.ver} - - - - - org.hibernate - hibernate-core - ${hibernate.core.ver} - - - - - com.google.auto.service - auto-service - ${google.auto.service.ver} - provided - true - - - - org.jetbrains - annotations - ${jetbrains.annotations.ver} - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${plugin.maven.compiler.ver} - - ${maven.compiler.source} - ${maven.compiler.target} - - - - - - - - - release - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${plugin.nexus.staging.ver} - true - - ossrh - https://s01.oss.sonatype.org/ - true - - - - org.apache.maven.plugins - maven-source-plugin - ${plugin.maven.source.ver} - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-gpg-plugin - ${plugin.maven.gpg.ver} - - - sign-artifacts - verify - - sign - - - - - - - - - - - scm:git:https://github.com/haiti-projects/haiti-framework.git - https://github.com/haiti-projects/haiti-framework - scm:git:https://github.com/haiti-projects/haiti-framework.git - - - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - - - - - uPagge - Struchkov Mark - mark@struchkov.dev - https://mark.struchkov.dev - - - - \ No newline at end of file diff --git a/haiti-exception/pom.xml b/haiti-exception/pom.xml index bb70599..8da069e 100644 --- a/haiti-exception/pom.xml +++ b/haiti-exception/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti-dependencies - 2.2.0 + 2.3.0 haiti-exception diff --git a/haiti-external-bom/pom.xml b/haiti-external-bom/pom.xml index 0ae9389..908946d 100644 --- a/haiti-external-bom/pom.xml +++ b/haiti-external-bom/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti-external-bom - 2.1.0 + 2.2.0 pom Haiti External Dependencies @@ -30,6 +30,10 @@ UTF-8 UTF-8 + 2.2 + 1.0.1 + 2.0.6 + 3.10.1 1.6.13 3.2.1 @@ -41,12 +45,17 @@ javax.persistence javax.persistence-api - 2.2 + ${javax.persistence.api.version} com.google.auto.service auto-service - 1.0.1 + ${google.auto.service.version} + + + org.slf4j + slf4j-api + ${slf4j.api.version} diff --git a/haiti-utils/pom.xml b/haiti-utils/pom.xml index 481beae..4d82d5b 100644 --- a/haiti-utils/pom.xml +++ b/haiti-utils/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti-dependencies - 2.2.0 + 2.3.0 Haiti Utils @@ -21,6 +21,10 @@ dev.struchkov.haiti haiti-exception + + org.slf4j + slf4j-api + \ No newline at end of file diff --git a/haiti-utils/src/main/java/dev/struchkov/haiti/utils/Checker.java b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/Checker.java index 93dea69..093b2c8 100644 --- a/haiti-utils/src/main/java/dev/struchkov/haiti/utils/Checker.java +++ b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/Checker.java @@ -1,6 +1,7 @@ package dev.struchkov.haiti.utils; import java.util.Collection; +import java.util.Map; import static dev.struchkov.haiti.utils.Exceptions.utilityClass; import static dev.struchkov.haiti.utils.Strings.EMPTY; @@ -48,6 +49,10 @@ public final class Checker { return collection != null && !collection.isEmpty(); } + public static boolean checkNotEmpty(Map map) { + return map != null && !map.isEmpty(); + } + /** * Проверка массива на пустоту * diff --git a/haiti-utils/src/main/java/dev/struchkov/haiti/utils/concurrent/ForkJoinUtils.java b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/concurrent/ForkJoinUtils.java new file mode 100644 index 0000000..e4eb2c6 --- /dev/null +++ b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/concurrent/ForkJoinUtils.java @@ -0,0 +1,63 @@ +package dev.struchkov.haiti.utils.concurrent; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ForkJoinTask; + +import static dev.struchkov.haiti.utils.Exceptions.utilityClass; + +public class ForkJoinUtils { + + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ForkJoinUtils.class); + + private ForkJoinUtils() { + utilityClass(); + } + + public static List pullTaskResults(List>> tasks) { + final List results = new ArrayList<>(); + Iterator>> iterator = tasks.iterator(); + while (!tasks.isEmpty()) { + while (iterator.hasNext()) { + final ForkJoinTask> task = iterator.next(); + if (task.isDone()) { + final List jsons; + try { + jsons = task.get(); + results.addAll(jsons); + } catch (InterruptedException | ExecutionException e) { + log.error(e.getMessage(), e); + Thread.currentThread().interrupt(); + } + iterator.remove(); + } + } + iterator = tasks.iterator(); + } + return results; + } + + public static List pullTaskResult(List> tasks) { + final List results = new ArrayList<>(); + Iterator> iterator = tasks.iterator(); + while (!tasks.isEmpty()) { + while (iterator.hasNext()) { + final ForkJoinTask task = iterator.next(); + if (task.isDone()) { + try { + results.add(task.get()); + } catch (InterruptedException | ExecutionException e) { + log.error(e.getMessage(), e); + Thread.currentThread().interrupt(); + } + iterator.remove(); + } + } + iterator = tasks.iterator(); + } + return results; + } + +} diff --git a/haiti-utils/src/main/java/module-info.java b/haiti-utils/src/main/java/module-info.java index 9df1e59..eb7c508 100644 --- a/haiti-utils/src/main/java/module-info.java +++ b/haiti-utils/src/main/java/module-info.java @@ -3,4 +3,6 @@ module haiti.utils { exports dev.struchkov.haiti.utils.domain; requires haiti.exception; + + requires org.slf4j; } \ No newline at end of file diff --git a/pom.xml b/pom.xml index aa99612..5c4046b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti-dependencies - 2.2.0 + 2.3.0 pom Haiti Framework @@ -35,8 +35,8 @@ UTF-8 UTF-8 - 2.2.0 - 2.1.0 + 2.3.0 + 2.2.0 ${haiti.ver} ${haiti.ver} ${haiti.ver}