Class TransportConnectionManager
- java.lang.Object
-
- org.apache.hugegraph.computer.core.network.connection.TransportConnectionManager
-
- All Implemented Interfaces:
ConnectionManager
public class TransportConnectionManager extends java.lang.Object implements ConnectionManager
-
-
Constructor Summary
Constructors Constructor Description TransportConnectionManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseClient(ConnectionId connectionId)Close a client from theConnectionManagerTransportClientgetOrCreateClient(java.lang.String host, int port)Get aTransportClientinstance from the connection pool first.TransportClientgetOrCreateClient(ConnectionId connectionId)Get aTransportClientinstance from the connection pool first.TransportServergetServer()Return the only one listened server.voidinitClientManager(org.apache.hugegraph.computer.core.config.Config config, ClientHandler clientHandler)Initialize the client connection manager.voidshutdown()Shutdown the client connection manager and server.voidshutdownClients()Shutdown the client connection manager.voidshutdownServer()Shutdown the server.intstartServer(org.apache.hugegraph.computer.core.config.Config config, MessageHandler serverHandler)Start the server, return the port listened.
-
-
-
Method Detail
-
startServer
public int startServer(org.apache.hugegraph.computer.core.config.Config config, MessageHandler serverHandler)Description copied from interface:ConnectionManagerStart the server, return the port listened. This method is called only once.- Specified by:
startServerin interfaceConnectionManager
-
getServer
public TransportServer getServer()
Description copied from interface:ConnectionManagerReturn the only one listened server.- Specified by:
getServerin interfaceConnectionManager
-
shutdownServer
public void shutdownServer()
Description copied from interface:ConnectionManagerShutdown the server.- Specified by:
shutdownServerin interfaceConnectionManager
-
initClientManager
public void initClientManager(org.apache.hugegraph.computer.core.config.Config config, ClientHandler clientHandler)Description copied from interface:ConnectionManagerInitialize the client connection manager. This method is called only once.- Specified by:
initClientManagerin interfaceConnectionManager
-
getOrCreateClient
public TransportClient getOrCreateClient(ConnectionId connectionId) throws TransportException
Description copied from interface:ConnectionManagerGet aTransportClientinstance from the connection pool first. If it is not found or not active, create a new one.- Specified by:
getOrCreateClientin interfaceConnectionManager- Parameters:
connectionId-ConnectionId- Throws:
TransportException
-
getOrCreateClient
public TransportClient getOrCreateClient(java.lang.String host, int port) throws TransportException
Description copied from interface:ConnectionManagerGet aTransportClientinstance from the connection pool first. If {it is not found or not active, create a new one.- Specified by:
getOrCreateClientin interfaceConnectionManager- Parameters:
host- the hostName or Ipport- the port- Throws:
TransportException
-
closeClient
public void closeClient(ConnectionId connectionId)
Description copied from interface:ConnectionManagerClose a client from theConnectionManager- Specified by:
closeClientin interfaceConnectionManager- Parameters:
connectionId-ConnectionId
-
shutdownClients
public void shutdownClients()
Description copied from interface:ConnectionManagerShutdown the client connection manager.- Specified by:
shutdownClientsin interfaceConnectionManager
-
shutdown
public void shutdown()
Description copied from interface:ConnectionManagerShutdown the client connection manager and server.- Specified by:
shutdownin interfaceConnectionManager
-
-