diff --git a/pom.xml b/pom.xml
index 5e60fa6..6aceccf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
4.0.0
ua.net.uid
uid.tools
- 1.0.2-SNAPSHOT
+ 1.0.3-SNAPSHOT
jar
@@ -99,34 +99,34 @@
uid-releases
-
-
- ua.net.uid-releases
- https://git.uid.net.ua/maven/releases/
-
-
- ua.net.uid-snapshots
- https://git.uid.net.ua/maven/snapshots/
-
-
-
scm:git:https://git.uid.net.ua/git/uid/uid.tools.git
scm:git:https://git.uid.net.ua/git/uid/uid.tools.git
https://git.uid.net.ua/git/uid/uid.tools.git
- HEAD
-
-
+ HEAD
+
+
+
+
+ uid-gitbucket-maven-repository-releases
+ https://git.uid.net.ua/maven/releases/
+
+
+ uid-gitbucket-maven-repository-snapshots
+ https://git.uid.net.ua/maven/snapshots/
+
+
+
- uid-releases
+ uid-gitbucket-maven-repository-releases
Release repository
https://git.uid.net.ua/maven/releases/
- uid-snapshots
+ uid-gitbucket-maven-repository-snapshots
Snapshots repository
https://git.uid.net.ua/maven/snapshots/
-
+
\ No newline at end of file
diff --git a/src/main/java/ua/net/uid/utils/concurrent/Promise.java b/src/main/java/ua/net/uid/utils/concurrent/Promise.java
new file mode 100644
index 0000000..556c5f3
--- /dev/null
+++ b/src/main/java/ua/net/uid/utils/concurrent/Promise.java
@@ -0,0 +1,373 @@
+/*
+ * Copyright 2020 nightfall.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ua.net.uid.utils.concurrent;
+
+import java.util.Queue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.ForkJoinTask;
+import ua.net.uid.utils.Function;
+
+/**
+ * !WIP! not for use
+ *
+ * @author nightfall
+ * @param
+ */
+public class Promise {
+ ////////////////////////////////////////////////////////////////////////////
+ public enum State { PENDING, FULFILLED, REJECTED }
+ ////////////////////////////////////////////////////////////////////////////
+ public interface Resolver {
+ void accept(V value);
+ void reject(Throwable error);
+ }
+ public interface Performer {
+ void apply(Resolver resolver) throws Throwable;
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ public static Promise resolve(V value) {
+ return new Promise<>(value, 0);
+ }
+ public static Promise reject(Throwable error) {
+ return new Promise<>(error, false);
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ /*
+ public static Promise> all(Promise extends E> ... promises) {
+ return all(Arrays.asList(promises));
+ }
+ public static Promise> all(Iterable extends Promise extends E>> promises) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ public static Promise> allSettled(Promise extends E> ... promises) {
+ return allSettled(Arrays.asList(promises));
+ }
+ public static Promise> allSettled(Iterable extends Promise extends E>> promises) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ public static Promise> any(Promise extends E> ... promises) {
+ return any(Arrays.asList(promises));
+ }
+ public static Promise> any(Iterable extends Promise extends E>> promises) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ public static Promise> race(Promise extends E> ... promises) {
+ return race(Arrays.asList(promises));
+ }
+ public static Promise> race(Iterable extends Promise extends E>> promises) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+ */
+ ////////////////////////////////////////////////////////////////////////////
+ private volatile Internal internal;
+ ////////////////////////////////////////////////////////////////////////////
+ private Promise(V value, int any) {
+ internal = new Fulfilled(value);
+ }
+ private Promise(Throwable error, boolean any) {
+ internal = new Rejected(error);
+ }
+
+ public Promise(Callable extends V> task) {
+ this((resolver) -> {
+ try {
+ resolver.accept(task.call());
+ } catch (Throwable ex) {
+ resolver.reject(ex);
+ }
+ });
+ }
+ public Promise(Performer performer) {
+ internal = new Pending(performer);
+ internal.run();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ public State getState() {
+ return internal.getState();
+ }
+ public V getValue() {
+ internal.sync();
+ return internal.getValue();
+ }
+ public Throwable getError() {
+ internal.sync();
+ return internal.getError();
+ }
+ public Promise sync() {
+ internal.sync();
+ return this;
+ }
+ public Promise then(Function callback) {
+ return internal.then(callback);
+ }
+ public Promise then(U value) {
+ return internal.then(value);
+ }
+ public Promise except(Function callback) {
+ return internal.except(callback);
+ }
+ public Promise except(U value) {
+ return internal.except(value);
+ }
+ public Promise anyway(Function