Interface AFRMIService

All Superinterfaces:
Remote

public interface AFRMIService extends Remote
The AFRMIService assigns and keeps track of anonymous ports, among other things. This feature is to be used by AFRMISocketFactory only.
Author:
Christian Kohlschütter
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether a remote-shutdown of the RMI registry is allowed.
    int
    Registers a new anonymous port and returns it.
    Returns a stream of open ports.
    void
    Adds the given Closeable to the list of instances to be closed upon shutdown of the RMI registry.
    void
    returnPort(int port)
    Returns a previously registered port.
    void
    Asks that this RMI registry gets shut down.
    void
    Removes the given Closeable from the list of instances to be closed upon shutdown of the RMI registry.
  • Method Details

    • newPort

      int newPort() throws IOException
      Registers a new anonymous port and returns it. When the port is not required anymore, it must be returned via returnPort(int).
      Returns:
      The new port.
      Throws:
      IOException - if the operation fails.
    • returnPort

      void returnPort(int port) throws IOException
      Returns a previously registered port. No error is thrown if the given port has not been assigned before.
      Parameters:
      port - The port.
      Throws:
      IOException - if the operation fails.
    • openPorts

      IntStream openPorts() throws RemoteException
      Returns a stream of open ports.
      Returns:
      A sequence of open ports.
      Throws:
      RemoteException - if the operation fails.
    • isShutdownAllowed

      boolean isShutdownAllowed() throws RemoteException
      Indicates whether a remote-shutdown of the RMI registry is allowed. NOTE: A call to shutdown() may or may not succeed regardless.
      Returns:
      Indication of whether a remote-shutdown of the RMI registry is allowed.
      Throws:
      RemoteException - if the operation fails.
    • shutdown

      void shutdown() throws RemoteException
      Asks that this RMI registry gets shut down.
      Throws:
      RemoteException - if the operation fails.
    • registerForShutdown

      void registerForShutdown(Closeable closeable) throws RemoteException
      Adds the given Closeable to the list of instances to be closed upon shutdown of the RMI registry.
      Parameters:
      closeable - The instance.
      Throws:
      RemoteException - if the operation fails.
    • unregisterForShutdown

      void unregisterForShutdown(Closeable closeable) throws RemoteException
      Removes the given Closeable from the list of instances to be closed upon shutdown of the RMI registry. No error is returned if the given element was not registered before.
      Parameters:
      closeable - The instance.
      Throws:
      RemoteException - if the operation fails.