allow NetworkContext to return a handle to the EventLoop
package net.openhft.chronicle.network;
import net.openhft.chronicle.core.io.Closeable;
+import net.openhft.chronicle.core.threads.EventLoop;
import net.openhft.chronicle.network.api.TcpHandler;
import net.openhft.chronicle.network.api.session.SessionDetailsProvider;
import net.openhft.chronicle.network.cluster.TerminationEventHandler;
@@ -26,6 +27,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.nio.channels.SocketChannel;
+import java.util.function.Supplier;
public interface NetworkContext<T extends NetworkContext> extends Closeable {
@@ -101,5 +103,11 @@ public interface NetworkContext<T extends NetworkContext> extends Closeable {
NetworkStatsListener networkStatsListener();
void serverThreadingStrategy(ServerThreadingStrategy singleThreaded);
+
+ default Supplier<EventLoop> eventLoopSupplier() {
+ return () -> {
+ throw new UnsupportedOperationException("Not supported by this type of NetworkContext");
+ };
+ }
}
