Package org.jppf.nio
Class NioHelper
java.lang.Object
org.jppf.nio.NioHelper
Utility methods to help with managing nio servers.
- Author:
- Laurent Cohen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPort(int port) Add the specified port to the list of ports.static AcceptorNioServergetAcceptorServer(boolean create) Get the acceptor server.static NioHelpergetNioHelper(int port) Get theNioHelperinstance mapped to the specified port.getPorts()Get the list of ports.getServer(int identifier) Get the server mapped to the specified identifier.static voidputNioHelper(int port, NioHelper nioHelper) Map a new port to the specifiedNioHelperinstance.voidMap the specified server tot he specified identifier.static voidremoveNioHelper(int port) Remove a port mùapping.voidremovePort(int port) Remove the specified port from the list of ports.removeServer(int identifier) Map the specified server tot he specified identifier.static voidsetAcceptorServer(AcceptorNioServer acceptorServer) Get the acceptor server.
-
Constructor Details
-
NioHelper
public NioHelper()
-
-
Method Details
-
getNioHelper
Get theNioHelperinstance mapped to the specified port.- Parameters:
port- the port number to lookup.- Returns:
- the
NioHelperthe port is mapped to, ornullif the port is not mapped.
-
putNioHelper
Map a new port to the specifiedNioHelperinstance.- Parameters:
port- the port number to map.nioHelper- theNioHelperto map the port to.
-
removeNioHelper
public static void removeNioHelper(int port) Remove a port mùapping.- Parameters:
port- the port number to remove.
-
putServer
Map the specified server tot he specified identifier.- Parameters:
identifier- the JPPF identifier to mao to.server- the server to map.
-
addPort
public void addPort(int port) Add the specified port to the list of ports.- Parameters:
port- the port to add.
-
removePort
public void removePort(int port) Remove the specified port from the list of ports.- Parameters:
port- the port to remove.
-
getPorts
Get the list of ports.- Returns:
- a copy of the list of ports.
-
removeServer
Map the specified server tot he specified identifier.- Parameters:
identifier- the JPPF identifier to mao to.- Returns:
- the server that was removed, or
nullif there was no server for the specified identifier.
-
getServer
Get the server mapped to the specified identifier. -
getAcceptorServer
Get the acceptor server.- Parameters:
create- whether to create a new acceptor if none exists.- Returns:
- a
AcceptorNioServerinstance. - Throws:
Exception- if any error occurs.
-
setAcceptorServer
Get the acceptor server.- Parameters:
acceptorServer- the acceptor server to set.- Throws:
Exception- if any error occurs.
-