File tree Expand file tree Collapse file tree 3 files changed +6
-21
lines changed
src/main/java/conseq4j/execute Expand file tree Collapse file tree 3 files changed +6
-21
lines changed Original file line number Diff line number Diff line change 2727 <modelVersion >4.0.0</modelVersion >
2828 <groupId >io.github.q3769</groupId >
2929 <artifactId >conseq4j</artifactId >
30- <version >20230922.20230924.20240515 </version >
30+ <version >20230922.20230924.20240516 </version >
3131 <packaging >jar</packaging >
3232 <name >conseq4j</name >
3333 <description >A Java concurrent API to sequence related tasks while concurring unrelated ones</description >
Original file line number Diff line number Diff line change 3030import conseq4j .Terminable ;
3131import java .util .List ;
3232import java .util .Map ;
33- import java .util .concurrent .Callable ;
34- import java .util .concurrent .CompletableFuture ;
35- import java .util .concurrent .ConcurrentHashMap ;
36- import java .util .concurrent .ConcurrentMap ;
37- import java .util .concurrent .ExecutorService ;
38- import java .util .concurrent .Executors ;
39- import java .util .concurrent .Future ;
33+ import java .util .concurrent .*;
4034import javax .annotation .Nonnull ;
4135import javax .annotation .concurrent .ThreadSafe ;
4236import lombok .NonNull ;
@@ -93,17 +87,6 @@ private static ConditionFactory await() {
9387 return Awaitility .await ().forever ();
9488 }
9589
96- /**
97- * @param command the command to run asynchronously in proper sequence
98- * @param sequenceKey the key under which this task should be sequenced
99- * @return future result of the command, not downcast-able from the basic {@link Future} interface.
100- * @see ConseqExecutor#submit(Callable, Object)
101- */
102- @ Override
103- public @ NonNull Future <Void > execute (@ NonNull Runnable command , @ NonNull Object sequenceKey ) {
104- return submit (Executors .callable (command , null ), sequenceKey );
105- }
106-
10790 /**
10891 * Tasks of different sequence keys execute in parallel, pending thread availability from the backing
10992 * {@link #workerExecutorService}.
Original file line number Diff line number Diff line change 2525package conseq4j .execute ;
2626
2727import java .util .concurrent .Callable ;
28+ import java .util .concurrent .Executors ;
2829import java .util .concurrent .Future ;
2930
3031/**
@@ -48,8 +49,9 @@ public interface SequentialExecutor {
4849 * @param sequenceKey the key under which all tasks are executed sequentially
4950 * @return future holding run status of the submitted command
5051 */
51- Future <Void > execute (Runnable command , Object sequenceKey );
52-
52+ default Future <Void > execute (Runnable command , Object sequenceKey ) {
53+ return submit (Executors .callable (command , null ), sequenceKey );
54+ }
5355 /**
5456 * @param task the Callable task to run sequentially with others under the same sequence key
5557 * @param sequenceKey the key under which all tasks are executed sequentially
You can’t perform that action at this time.
0 commit comments