open class RmiRegistryFactoryBean : FactoryBean<Registry>, InitializingBean, DisposableBean
FactoryBean that locates a java.rmi.registry.Registry and exposes it for bean references. Can also create a local RMI registry on the fly if none exists already.
Can be used to set up and pass around the actual Registry object to applications objects that need to work with RMI. One example for such an object that needs to work with RMI is Spring's RmiServiceExporter, which either works with a passed-in Registry reference or falls back to the registry as specified by its local properties and defaults.
Also useful to enforce creation of a local RMI registry at a given port, for example for a JMX connector. If used in conjunction with org.springframework.jmx.support.ConnectorServerFactoryBean, it is recommended to mark the connector definition (ConnectorServerFactoryBean) as "depends-on" the registry definition (RmiRegistryFactoryBean), to guarantee starting up the registry first.
Note: The implementation of this class mirrors the corresponding logic in RmiServiceExporter, and also offers the same customization hooks. RmiServiceExporter implements its own registry lookup as a convenience: It is very common to simply rely on the registry defaults.
Author
Juergen Hoeller
Since
1.2.3
See Also
RmiServiceExporter#setRegistryorg.springframework.jmx.support.ConnectorServerFactoryBeanjava.rmi.registry.Registryjava.rmi.registry.LocateRegistry
RmiRegistryFactoryBean()
FactoryBean that locates a java.rmi.registry.Registry and exposes it for bean references. Can also create a local RMI registry on the fly if none exists already. Can be used to set up and pass around the actual Registry object to applications objects that need to work with RMI. One example for such an object that needs to work with RMI is Spring's RmiServiceExporter, which either works with a passed-in Registry reference or falls back to the registry as specified by its local properties and defaults. Also useful to enforce creation of a local RMI registry at a given port, for example for a JMX connector. If used in conjunction with org.springframework.jmx.support.ConnectorServerFactoryBean, it is recommended to mark the connector definition (ConnectorServerFactoryBean) as "depends-on" the registry definition (RmiRegistryFactoryBean), to guarantee starting up the registry first. Note: The implementation of this class mirrors the corresponding logic in RmiServiceExporter, and also offers the same customization hooks. RmiServiceExporter implements its own registry lookup as a convenience: It is very common to simply rely on the registry defaults. |
open fun afterPropertiesSet(): Unit |
|
open fun destroy(): Unit
Unexport the RMI registry on bean factory shutdown, provided that this bean actually created a registry. |
|
open fun getHost(): String
Return the host of the registry for the exported RMI service. |
|
open fun getObject(): Registry |
|
open fun getObjectType(): Class<out Registry> |
|
open fun getPort(): Int
Return the port of the registry for the exported RMI service. |
|
open fun isSingleton(): Boolean |
|
open fun setAlwaysCreate(alwaysCreate: Boolean): Unit
Set whether to always create the registry in-process, not attempting to locate an existing registry at the specified port. Default is "false". Switch this flag to "true" in order to avoid the overhead of locating an existing registry when you always intend to create a new registry in any case. |
|
open fun setClientSocketFactory(clientSocketFactory: RMIClientSocketFactory): Unit
Set a custom RMI client socket factory to use for the RMI registry. If the given object also implements |
|
open fun setHost(host: String): Unit
Set the host of the registry for the exported RMI service, i.e. Default is localhost. |
|
open fun setPort(port: Int): Unit
Set the port of the registry for the exported RMI service, i.e. Default is |
|
open fun setServerSocketFactory(serverSocketFactory: RMIServerSocketFactory): Unit
Set a custom RMI server socket factory to use for the RMI registry. Only needs to be specified when the client socket factory does not implement |