- 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 TypeMethodDescriptionboolean
Indicates whether a remote-shutdown of the RMI registry is allowed.int
newPort()
Registers a new anonymous port and returns it.Returns a stream of open ports.void
registerForShutdown
(Closeable closeable) Adds the givenCloseable
to the list of instances to be closed upon shutdown of the RMI registry.void
returnPort
(int port) Returns a previously registered port.void
shutdown()
Asks that this RMI registry gets shut down.void
unregisterForShutdown
(Closeable closeable) Removes the givenCloseable
from 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 givenCloseable
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
Removes the givenCloseable
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.
-