- All Superinterfaces:
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 TypeMethodDescriptionbooleanIndicates whether a remote-shutdown of the RMI registry is allowed.intnewPort()Registers a new anonymous port and returns it.Returns a stream of open ports.voidregisterForShutdown(Closeable closeable) Adds the givenCloseableto the list of instances to be closed upon shutdown of the RMI registry.voidreturnPort(int port) Returns a previously registered port.voidshutdown()Asks that this RMI registry gets shut down.voidunregisterForShutdown(Closeable closeable) Removes the givenCloseablefrom the list of instances to be closed upon shutdown of the RMI registry.
-
Method Details
-
newPort
Registers a new anonymous port and returns it. When the port is not required anymore, it must be returned viareturnPort(int).- Returns:
- The new port.
- Throws:
IOException- if the operation fails.
-
returnPort
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
Returns a stream of open ports.- Returns:
- A sequence of open ports.
- Throws:
RemoteException- if the operation fails.
-
isShutdownAllowed
Indicates whether a remote-shutdown of the RMI registry is allowed. NOTE: A call toshutdown()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
Asks that this RMI registry gets shut down.- Throws:
RemoteException- if the operation fails.
-
registerForShutdown
Adds the givenCloseableto the list of instances to be closed upon shutdown of the RMI registry.- Parameters:
closeable- The instance.- Throws:
RemoteException- if the operation fails.
-
unregisterForShutdown
Removes the givenCloseablefrom 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.
-