Package io.aether.net.fastMeta.netty
Class NettyFastMetaNet
java.lang.Object
io.aether.net.fastMeta.netty.NettyFastMetaNet
- All Implemented Interfaces:
io.aether.net.fastMeta.FastMetaNet,AutoCloseable
public class NettyFastMetaNet
extends Object
implements io.aether.net.fastMeta.FastMetaNet, AutoCloseable
Netty-based implementation of the FastMetaNet factory with
auto-selection of the optimal transport (Epoll/KQueue/NIO)
AND reference counting for shared EventLoopGroups.
Uses non-blocking AtomicReference operations to manage group lifecycles.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.aether.net.fastMeta.FastMetaNet
io.aether.net.fastMeta.FastMetaNet.Connection<LT,RT extends io.aether.net.fastMeta.RemoteApi>, io.aether.net.fastMeta.FastMetaNet.WritableConsumer -
Field Summary
Fields inherited from interface io.aether.net.fastMeta.FastMetaNet
INSTANCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled by clients/servers on creation to increment the ref count and ensure the worker group is initialized.voidclose()Shuts down the Netty I/O thread pools if this instance is closed.io.netty.channel.EventLoopGroupGets the boss EventLoopGroup, initializing it if necessary.Class<? extends io.netty.channel.Channel> Gets the appropriate Netty Channel class for clients based on the detected transport.Class<? extends io.netty.channel.ServerChannel> Gets the appropriate Netty ServerChannel class based on the detected transport.io.netty.channel.EventLoopGroupGets the shared worker EventLoopGroup, initializing it if necessary.<LT,RT extends io.aether.net.fastMeta.RemoteApi>
io.aether.net.fastMeta.FastMetaClient<LT, RT> makeClient(URI uri, io.aether.net.fastMeta.FastMetaApi<LT, ?> lt, io.aether.net.fastMeta.FastMetaApi<?, RT> rt, io.aether.utils.interfaces.AFunction<RT, LT> localApi, io.aether.net.fastMeta.FastMetaNet.WritableConsumer writableConsumer) <LT,RT extends io.aether.net.fastMeta.RemoteApi>
io.aether.net.fastMeta.FastMetaServer<LT, RT> makeServer(URI uri, io.aether.net.fastMeta.FastMetaApi<LT, ?> localApiMeta, io.aether.net.fastMeta.FastMetaApi<?, RT> remoteApiMeta, io.aether.net.fastMeta.FastMetaServer.Handler<LT, RT> handler) voidCalled by clients/servers on destroy() to decrement the ref count and shut down groups if the count reaches zero.
-
Constructor Details
-
NettyFastMetaNet
public NettyFastMetaNet()Initializes the NettyFastMetaNet. EventLoopGroups are NOT created here; they are created lazily on first use.
-
-
Method Details
-
close
public void close()Shuts down the Netty I/O thread pools if this instance is closed. Per AutoCloseable interface.- Specified by:
closein interfaceAutoCloseable
-
getServerChannelClass
Gets the appropriate Netty ServerChannel class based on the detected transport.- Returns:
- The ServerChannel class.
-
getClientChannelClass
Gets the appropriate Netty Channel class for clients based on the detected transport.- Returns:
- The Channel class.
-
getWorkerGroup
public io.netty.channel.EventLoopGroup getWorkerGroup()Gets the shared worker EventLoopGroup, initializing it if necessary. Called by both clients and servers.- Returns:
- The worker EventLoopGroup.
-
getBossGroup
public io.netty.channel.EventLoopGroup getBossGroup()Gets the boss EventLoopGroup, initializing it if necessary. Called ONLY by servers.- Returns:
- The boss EventLoopGroup.
-
makeClient
public <LT,RT extends io.aether.net.fastMeta.RemoteApi> io.aether.net.fastMeta.FastMetaClient<LT,RT> makeClient(URI uri, io.aether.net.fastMeta.FastMetaApi<LT, ?> lt, io.aether.net.fastMeta.FastMetaApi<?, RT> rt, io.aether.utils.interfaces.AFunction<RT, LT> localApi, io.aether.net.fastMeta.FastMetaNet.WritableConsumer writableConsumer) - Specified by:
makeClientin interfaceio.aether.net.fastMeta.FastMetaNet
-
makeServer
public <LT,RT extends io.aether.net.fastMeta.RemoteApi> io.aether.net.fastMeta.FastMetaServer<LT,RT> makeServer(URI uri, io.aether.net.fastMeta.FastMetaApi<LT, ?> localApiMeta, io.aether.net.fastMeta.FastMetaApi<?, RT> remoteApiMeta, io.aether.net.fastMeta.FastMetaServer.Handler<LT, RT> handler) - Specified by:
makeServerin interfaceio.aether.net.fastMeta.FastMetaNet