Package org.jppf.nio

Class NioHelper

java.lang.Object
org.jppf.nio.NioHelper

public class NioHelper extends Object
Utility methods to help with managing nio servers.
Author:
Laurent Cohen
  • Constructor Details

    • NioHelper

      public NioHelper()
  • Method Details

    • getNioHelper

      public static NioHelper getNioHelper(int port)
      Get the NioHelper instance mapped to the specified port.
      Parameters:
      port - the port number to lookup.
      Returns:
      the NioHelper the port is mapped to, or null if the port is not mapped.
    • putNioHelper

      public static void putNioHelper(int port, NioHelper nioHelper)
      Map a new port to the specified NioHelper instance.
      Parameters:
      port - the port number to map.
      nioHelper - the NioHelper to map the port to.
    • removeNioHelper

      public static void removeNioHelper(int port)
      Remove a port mùapping.
      Parameters:
      port - the port number to remove.
    • putServer

      public void putServer(int identifier, NioServer server)
      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

      public List<Integer> getPorts()
      Get the list of ports.
      Returns:
      a copy of the list of ports.
    • removeServer

      public NioServer removeServer(int identifier)
      Map the specified server tot he specified identifier.
      Parameters:
      identifier - the JPPF identifier to mao to.
      Returns:
      the server that was removed, or null if there was no server for the specified identifier.
    • getServer

      public NioServer getServer(int identifier) throws Exception
      Get the server mapped to the specified identifier.
      Parameters:
      identifier - the JPPF identifier to lookup.
      Returns:
      a NioServer instance.
      Throws:
      Exception - if any error occurs.
    • getAcceptorServer

      public static AcceptorNioServer getAcceptorServer(boolean create) throws Exception
      Get the acceptor server.
      Parameters:
      create - whether to create a new acceptor if none exists.
      Returns:
      a AcceptorNioServer instance.
      Throws:
      Exception - if any error occurs.
    • setAcceptorServer

      public static void setAcceptorServer(AcceptorNioServer acceptorServer) throws Exception
      Get the acceptor server.
      Parameters:
      acceptorServer - the acceptor server to set.
      Throws:
      Exception - if any error occurs.