Class DefaultConnectionManager
java.lang.Object
com.iohao.net.server.connection.DefaultConnectionManager
- All Implemented Interfaces:
CommonConnectionManager, ConnectionManager
Default Aeron-based
ConnectionManager implementation for net-server peers.- Since:
- 25.1
- Author:
- 渔民小镇
- date:
- 2025-09-06
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnection(ConnectionItem connection) voidbooleancontainsNetId(int netId) Tests whether a publication mapping exists for the given network id.io.aeron.PublicationgetPublicationByNetId(int netId) Gets the Aeron publication bound to the given network id.intpoll(io.aeron.logbuffer.FragmentHandler fragmentHandler) Polls inbound fragments and dispatches them to the provided fragment handler.voidpublishMessage(int serverId, Object message) voidpublishMessage(String pubName, Object message) Publishes a message through the named publication pipeline.voidpublishMessageByNetId(int netId, Object message) voidpublishMessageToCenter(Object message)
-
Constructor Details
-
DefaultConnectionManager
-
-
Method Details
-
containsNetId
public boolean containsNetId(int netId) Description copied from interface:CommonConnectionManagerTests whether a publication mapping exists for the given network id.- Specified by:
containsNetIdin interfaceCommonConnectionManager- Parameters:
netId- network id- Returns:
- true if the mapping exists
-
awaitConnect
public void awaitConnect()- Specified by:
awaitConnectin interfaceConnectionManager
-
getPublicationByNetId
public io.aeron.Publication getPublicationByNetId(int netId) Description copied from interface:CommonConnectionManagerGets the Aeron publication bound to the given network id.- Specified by:
getPublicationByNetIdin interfaceCommonConnectionManager- Parameters:
netId- network id- Returns:
- publication, or null if absent
-
publishMessageToCenter
- Specified by:
publishMessageToCenterin interfaceConnectionManager
-
publishMessage
- Specified by:
publishMessagein interfaceConnectionManager
-
publishMessage
Description copied from interface:CommonConnectionManagerPublishes a message through the named publication pipeline.- Specified by:
publishMessagein interfaceCommonConnectionManager- Parameters:
pubName- publication namemessage- message to publish
-
publishMessageByNetId
- Specified by:
publishMessageByNetIdin interfaceConnectionManager
-
addConnection
- Specified by:
addConnectionin interfaceConnectionManager
-
poll
public int poll(io.aeron.logbuffer.FragmentHandler fragmentHandler) Description copied from interface:CommonConnectionManagerPolls inbound fragments and dispatches them to the provided fragment handler.- Specified by:
pollin interfaceCommonConnectionManager- Parameters:
fragmentHandler- fragment callback- Returns:
- number of fragments processed
-