refactor into subprojects event-api, event-async, event-common, event-loop, event-net-http

This commit is contained in:
Jörg Prante 2024-01-11 18:20:30 +01:00
parent d72fee9ce8
commit 2451ef06f5
373 changed files with 757 additions and 1473 deletions

View file

@ -6,7 +6,7 @@ plugins {
wrapper {
gradleVersion = libs.versions.gradle.get()
distributionType = Wrapper.DistributionType.ALL
distributionType = Wrapper.DistributionType.BIN
}
ext {
@ -24,12 +24,15 @@ ext {
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
apply plugin: 'java-library'
apply from: rootProject.file('gradle/compile/java.gradle')
apply from: rootProject.file('gradle/test/junit5.gradle')
apply from: rootProject.file('gradle/repositories/maven.gradle')
apply from: rootProject.file('gradle/publish/maven.gradle')
subprojects {
apply from: rootProject.file('gradle/compile/java.gradle')
apply from: rootProject.file('gradle/test/junit5.gradle')
apply from: rootProject.file('gradle/repositories/maven.gradle')
}
apply from: rootProject.file('gradle/publish/sonatype.gradle')
apply from: rootProject.file('gradle/publish/forgejo.gradle')
/*
dependencies {
api libs.settings.api
implementation libs.net
@ -41,3 +44,4 @@ dependencies {
testImplementation libs.rxjava3
testImplementation libs.settings.datastructures.json
}
*/

View file

@ -0,0 +1,3 @@
module org.xbib.event.api {
exports org.xbib.event;
}

5
event-async/build.gradle Normal file
View file

@ -0,0 +1,5 @@
dependencies {
api project(':event-loop')
implementation libs.reactivestreams
testImplementation libs.rxjava3
}

View file

@ -0,0 +1,11 @@
module org.xbib.event.async {
exports org.xbib.event.async;
exports org.xbib.event.async.impl;
exports org.xbib.event.async.impl.future;
exports org.xbib.event.async.spi;
exports org.xbib.event.async.streams;
exports org.xbib.event.async.streams.impl;
requires org.xbib.event.loop;
requires org.reactivestreams;
requires java.logging;
}

View file

@ -0,0 +1,56 @@
package org.xbib.event.async.impl;
import org.xbib.event.loop.thread.FastThreadLocalThread;
import org.xbib.event.loop.thread.ThreadInfo;
import java.util.concurrent.TimeUnit;
public class AsyncThread extends FastThreadLocalThread {
private final boolean worker;
final ThreadInfo info;
ContextInternal context;
ClassLoader topLevelTCCL;
public AsyncThread(Runnable target, String name, boolean worker, long maxExecTime, TimeUnit maxExecTimeUnit) {
super(target, name);
this.worker = worker;
this.info = new ThreadInfo(maxExecTimeUnit, maxExecTime);
}
/**
* @return the current context of this thread, this method must be called from the current thread
*/
ContextInternal context() {
return context;
}
void executeStart() {
if (context == null) {
info.startTime = System.nanoTime();
}
}
void executeEnd() {
if (context == null) {
info.startTime = 0;
}
}
public long startTime() {
return info.startTime;
}
public boolean isWorker() {
return worker;
}
public long maxExecTime() {
return info.maxExecTime;
}
public TimeUnit maxExecTimeUnit() {
return info.maxExecTimeUnit;
}
}

View file

@ -1,6 +1,6 @@
package org.xbib.event.async.impl.future;
import org.xbib.event.Future;
import org.xbib.event.loop.Future;
import org.xbib.event.async.AsyncResult;
import org.xbib.event.async.impl.ContextInternal;

View file

@ -1,6 +1,6 @@
package org.xbib.event.async.impl.future;
import org.xbib.event.FutureListener;
import org.xbib.event.loop.FutureListener;
import org.xbib.event.async.Promise;
import org.xbib.event.async.impl.ContextInternal;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import java.io.IOException;
import java.nio.ByteBuffer;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import org.reactivestreams.Subscriber;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import org.reactivestreams.Subscriber;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import org.reactivestreams.Subscriber;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

View file

@ -1,6 +1,6 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.io.IOException;
import java.nio.file.Path;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import java.io.IOException;
import java.nio.ByteBuffer;

View file

@ -1,7 +1,7 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import org.reactivestreams.Publisher;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import org.reactivestreams.Subscription;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

View file

@ -1,4 +1,4 @@
package org.xbib.event.io;
package org.xbib.event.async.io;
import java.util.function.Consumer;

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield;
package org.xbib.event.async.yield;
/**
* Sequential traverser with internal and individually step approach.

View file

@ -1,16 +1,16 @@
package org.xbib.event.yield;
package org.xbib.event.async.yield;
import org.xbib.event.yield.async.AsyncQueryDistinct;
import org.xbib.event.yield.async.AsyncQueryFilter;
import org.xbib.event.yield.async.AsyncQueryFlatMapConcat;
import org.xbib.event.yield.async.AsyncQueryFlatMapMerge;
import org.xbib.event.yield.async.AsyncQueryFork;
import org.xbib.event.yield.async.AsyncQueryMap;
import org.xbib.event.yield.async.AsyncQueryOf;
import org.xbib.event.yield.async.AsyncQueryOfIterator;
import org.xbib.event.yield.async.AsyncQueryOnNext;
import org.xbib.event.yield.async.AsyncQuerySkip;
import org.xbib.event.yield.async.AsyncQueryTakeWhile;
import org.xbib.event.async.yield.async.AsyncQueryDistinct;
import org.xbib.event.async.yield.async.AsyncQueryFilter;
import org.xbib.event.async.yield.async.AsyncQueryFlatMapConcat;
import org.xbib.event.async.yield.async.AsyncQueryFlatMapMerge;
import org.xbib.event.async.yield.async.AsyncQueryFork;
import org.xbib.event.async.yield.async.AsyncQueryMap;
import org.xbib.event.async.yield.async.AsyncQueryOf;
import org.xbib.event.async.yield.async.AsyncQueryOfIterator;
import org.xbib.event.async.yield.async.AsyncQueryOnNext;
import org.xbib.event.async.yield.async.AsyncQuerySkip;
import org.xbib.event.async.yield.async.AsyncQueryTakeWhile;
import java.util.Iterator;
import java.util.function.BiConsumer;

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield;
package org.xbib.event.async.yield;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

View file

@ -1,32 +1,32 @@
package org.xbib.event.yield;
package org.xbib.event.async.yield;
import org.xbib.event.yield.boxes.BoolBox;
import org.xbib.event.yield.boxes.Box;
import org.xbib.event.yield.ops.Concat;
import org.xbib.event.yield.ops.Distinct;
import org.xbib.event.yield.ops.DropWhile;
import org.xbib.event.yield.ops.Filter;
import org.xbib.event.yield.ops.FlatMap;
import org.xbib.event.yield.ops.FromArray;
import org.xbib.event.yield.ops.FromList;
import org.xbib.event.yield.ops.FromStream;
import org.xbib.event.yield.ops.Generate;
import org.xbib.event.yield.ops.Iterate;
import org.xbib.event.yield.ops.Limit;
import org.xbib.event.yield.ops.Mapping;
import org.xbib.event.yield.ops.Peek;
import org.xbib.event.yield.ops.Skip;
import org.xbib.event.yield.ops.TakeWhile;
import org.xbib.event.yield.ops.Zip;
import org.xbib.event.yield.primitives.dbl.DoubleAdvancer;
import org.xbib.event.yield.primitives.dbl.DoubleQuery;
import org.xbib.event.yield.primitives.dbl.DoubleTraverser;
import org.xbib.event.yield.primitives.intgr.IntAdvancer;
import org.xbib.event.yield.primitives.intgr.IntQuery;
import org.xbib.event.yield.primitives.intgr.IntTraverser;
import org.xbib.event.yield.primitives.lng.LongAdvancer;
import org.xbib.event.yield.primitives.lng.LongQuery;
import org.xbib.event.yield.primitives.lng.LongTraverser;
import org.xbib.event.async.yield.boxes.BoolBox;
import org.xbib.event.async.yield.boxes.Box;
import org.xbib.event.async.yield.ops.Concat;
import org.xbib.event.async.yield.ops.Distinct;
import org.xbib.event.async.yield.ops.DropWhile;
import org.xbib.event.async.yield.ops.Filter;
import org.xbib.event.async.yield.ops.FlatMap;
import org.xbib.event.async.yield.ops.FromArray;
import org.xbib.event.async.yield.ops.FromList;
import org.xbib.event.async.yield.ops.FromStream;
import org.xbib.event.async.yield.ops.Generate;
import org.xbib.event.async.yield.ops.Iterate;
import org.xbib.event.async.yield.ops.Limit;
import org.xbib.event.async.yield.ops.Mapping;
import org.xbib.event.async.yield.ops.Peek;
import org.xbib.event.async.yield.ops.Skip;
import org.xbib.event.async.yield.ops.TakeWhile;
import org.xbib.event.async.yield.ops.Zip;
import org.xbib.event.async.yield.primitives.dbl.DoubleAdvancer;
import org.xbib.event.async.yield.primitives.dbl.DoubleQuery;
import org.xbib.event.async.yield.primitives.dbl.DoubleTraverser;
import org.xbib.event.async.yield.primitives.intgr.IntAdvancer;
import org.xbib.event.async.yield.primitives.intgr.IntQuery;
import org.xbib.event.async.yield.primitives.intgr.IntTraverser;
import org.xbib.event.async.yield.primitives.lng.LongAdvancer;
import org.xbib.event.async.yield.primitives.lng.LongQuery;
import org.xbib.event.async.yield.primitives.lng.LongTraverser;
import java.util.ArrayList;
import java.util.Arrays;

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield;
package org.xbib.event.async.yield;
@SuppressWarnings("serial")
public class TraversableFinishError extends Error {

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield;
package org.xbib.event.async.yield;
/**
* Bulk traversal.

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield;
package org.xbib.event.async.yield;
/**
* Equivalent to {@code Consumer<T>} with a yield semantics.

View file

@ -1,6 +1,6 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.util.HashSet;
import java.util.concurrent.CompletableFuture;

View file

@ -1,6 +1,6 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

View file

@ -1,6 +1,6 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

View file

@ -1,7 +1,7 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.util.ArrayList;
import java.util.List;

View file

@ -1,7 +1,7 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.yield.Query;
import org.xbib.event.async.yield.AsyncQuery;
import org.xbib.event.async.yield.Query;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

View file

@ -1,6 +1,6 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

View file

@ -1,7 +1,7 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.yield.Query;
import org.xbib.event.async.yield.AsyncQuery;
import org.xbib.event.async.yield.Query;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

View file

@ -1,6 +1,6 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.util.Iterator;
import java.util.concurrent.CompletableFuture;

View file

@ -1,6 +1,6 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

View file

@ -1,7 +1,7 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.yield.AsyncTraverser;
import org.xbib.event.async.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncTraverser;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

View file

@ -1,6 +1,6 @@
package org.xbib.event.yield.async;
package org.xbib.event.async.yield.async;
import org.xbib.event.yield.AsyncQuery;
import org.xbib.event.async.yield.AsyncQuery;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield.boxes;
package org.xbib.event.async.yield.boxes;
public class BoolBox {

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield.boxes;
package org.xbib.event.async.yield.boxes;
public class Box<T> {

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield.boxes;
package org.xbib.event.async.yield.boxes;
public class DoubleBox {

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield.boxes;
package org.xbib.event.async.yield.boxes;
public class IntBox {

View file

@ -1,4 +1,4 @@
package org.xbib.event.yield.boxes;
package org.xbib.event.async.yield.boxes;
public class LongBox {

View file

@ -1,9 +1,9 @@
package org.xbib.event.yield.ops;
package org.xbib.event.async.yield.ops;
import org.xbib.event.yield.Advancer;
import org.xbib.event.yield.Query;
import org.xbib.event.yield.Traverser;
import org.xbib.event.yield.Yield;
import org.xbib.event.async.yield.Advancer;
import org.xbib.event.async.yield.Query;
import org.xbib.event.async.yield.Traverser;
import org.xbib.event.async.yield.Yield;
public class Concat<T> implements Advancer<T>, Traverser<T> {

View file

@ -1,10 +1,10 @@
package org.xbib.event.yield.ops;
package org.xbib.event.async.yield.ops;
import org.xbib.event.yield.Advancer;
import org.xbib.event.yield.Query;
import org.xbib.event.yield.Traverser;
import org.xbib.event.yield.Yield;
import org.xbib.event.yield.boxes.BoolBox;
import org.xbib.event.async.yield.Advancer;
import org.xbib.event.async.yield.Query;
import org.xbib.event.async.yield.Traverser;
import org.xbib.event.async.yield.Yield;
import org.xbib.event.async.yield.boxes.BoolBox;
import java.util.HashSet;

View file

@ -1,9 +1,9 @@
package org.xbib.event.yield.ops;
package org.xbib.event.async.yield.ops;
import org.xbib.event.yield.Advancer;
import org.xbib.event.yield.Query;
import org.xbib.event.yield.Traverser;
import org.xbib.event.yield.Yield;
import org.xbib.event.async.yield.Advancer;
import org.xbib.event.async.yield.Query;
import org.xbib.event.async.yield.Traverser;
import org.xbib.event.async.yield.Yield;
import java.util.function.Predicate;

View file

@ -1,10 +1,10 @@
package org.xbib.event.yield.ops;
package org.xbib.event.async.yield.ops;
import org.xbib.event.yield.Advancer;
import org.xbib.event.yield.Query;
import org.xbib.event.yield.Traverser;
import org.xbib.event.yield.Yield;
import org.xbib.event.yield.boxes.BoolBox;
import org.xbib.event.async.yield.Advancer;
import org.xbib.event.async.yield.Query;
import org.xbib.event.async.yield.Traverser;
import org.xbib.event.async.yield.Yield;
import org.xbib.event.async.yield.boxes.BoolBox;
import java.util.function.Predicate;

View file

@ -1,9 +1,9 @@
package org.xbib.event.yield.ops;
package org.xbib.event.async.yield.ops;
import org.xbib.event.yield.Advancer;
import org.xbib.event.yield.Query;
import org.xbib.event.yield.Traverser;
import org.xbib.event.yield.Yield;
import org.xbib.event.async.yield.Advancer;
import org.xbib.event.async.yield.Query;
import org.xbib.event.async.yield.Traverser;
import org.xbib.event.async.yield.Yield;
import java.util.function.Function;

View file

@ -1,8 +1,8 @@
package org.xbib.event.yield.ops;
package org.xbib.event.async.yield.ops;
import org.xbib.event.yield.Advancer;
import org.xbib.event.yield.Traverser;
import org.xbib.event.yield.Yield;
import org.xbib.event.async.yield.Advancer;
import org.xbib.event.async.yield.Traverser;
import org.xbib.event.async.yield.Yield;
public class FromArray<U> implements Advancer<U>, Traverser<U> {

Some files were not shown because too many files have changed in this diff Show more