类 RmiRegistryFactoryBean

    • 字段详细资料

    • 方法详细资料

      • setHost

        public void setHost​(String host)
        Set the host of the registry for the exported RMI service, i.e. rmi://HOST:port/name

        Default is localhost.

      • getHost

        public String getHost()
        Return the host of the registry for the exported RMI service.
      • setPort

        public void setPort​(int port)
        Set the port of the registry for the exported RMI service, i.e. rmi://host:PORT/name

        Default is Registry.REGISTRY_PORT (1099).

      • getPort

        public int getPort()
        Return the port of the registry for the exported RMI service.
      • setAlwaysCreate

        public void setAlwaysCreate​(boolean alwaysCreate)
        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.

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws Exception
        从接口复制的说明: InitializingBean
        Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

        This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

        指定者:
        afterPropertiesSet 在接口中 InitializingBean
        抛出:
        Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
      • getRegistry

        protected Registry getRegistry​(String registryHost,
                                       int registryPort,
                                       @Nullable
                                       RMIClientSocketFactory clientSocketFactory,
                                       @Nullable
                                       RMIServerSocketFactory serverSocketFactory)
                                throws RemoteException
        Locate or create the RMI registry.
        参数:
        registryHost - the registry host to use (if this is specified, no implicit creation of a RMI registry will happen)
        registryPort - the registry port to use
        clientSocketFactory - the RMI client socket factory for the registry (if any)
        serverSocketFactory - the RMI server socket factory for the registry (if any)
        返回:
        the RMI registry
        抛出:
        RemoteException - if the registry couldn't be located or created
      • getRegistry

        protected Registry getRegistry​(int registryPort)
                                throws RemoteException
        Locate or create the RMI registry.
        参数:
        registryPort - the registry port to use
        返回:
        the RMI registry
        抛出:
        RemoteException - if the registry couldn't be located or created
      • testRegistry

        protected void testRegistry​(Registry registry)
                             throws RemoteException
        Test the given RMI registry, calling some operation on it to check whether it is still active.

        Default implementation calls Registry.list().

        参数:
        registry - the RMI registry to test
        抛出:
        RemoteException - if thrown by registry methods
        另请参阅:
        Registry.list()
      • getObject

        public Registry getObject()
                           throws Exception
        从接口复制的说明: FactoryBean
        Return an instance (possibly shared or independent) of the object managed by this factory.

        As with a BeanFactory, this allows support for both the Singleton and Prototype design pattern.

        If this FactoryBean is not fully initialized yet at the time of the call (for example because it is involved in a circular reference), throw a corresponding FactoryBeanNotInitializedException.

        As of Spring 2.0, FactoryBeans are allowed to return null objects. The factory will consider this as normal value to be used; it will not throw a FactoryBeanNotInitializedException in this case anymore. FactoryBean implementations are encouraged to throw FactoryBeanNotInitializedException themselves now, as appropriate.

        指定者:
        getObject 在接口中 FactoryBean<Registry>
        返回:
        an instance of the bean (can be null)
        抛出:
        Exception - in case of creation errors
        另请参阅:
        FactoryBeanNotInitializedException
      • getObjectType

        public Class<? extends RegistrygetObjectType()
        从接口复制的说明: FactoryBean
        Return the type of object that this FactoryBean creates, or null if not known in advance.

        This allows one to check for specific types of beans without instantiating objects, for example on autowiring.

        In the case of implementations that are creating a singleton object, this method should try to avoid singleton creation as far as possible; it should rather estimate the type in advance. For prototypes, returning a meaningful type here is advisable too.

        This method can be called before this FactoryBean has been fully initialized. It must not rely on state created during initialization; of course, it can still use such state if available.

        NOTE: Autowiring will simply ignore FactoryBeans that return null here. Therefore it is highly recommended to implement this method properly, using the current state of the FactoryBean.

        指定者:
        getObjectType 在接口中 FactoryBean<Registry>
        返回:
        the type of object that this FactoryBean creates, or null if not known at the time of the call
        另请参阅:
        ListableBeanFactory.getBeansOfType(java.lang.Class<T>)
      • isSingleton

        public boolean isSingleton()
        从接口复制的说明: FactoryBean
        Is the object managed by this factory a singleton? That is, will FactoryBean.getObject() always return the same object (a reference that can be cached)?

        NOTE: If a FactoryBean indicates to hold a singleton object, the object returned from getObject() might get cached by the owning BeanFactory. Hence, do not return true unless the FactoryBean always exposes the same reference.

        The singleton status of the FactoryBean itself will generally be provided by the owning BeanFactory; usually, it has to be defined as singleton there.

        NOTE: This method returning false does not necessarily indicate that returned objects are independent instances. An implementation of the extended SmartFactoryBean interface may explicitly indicate independent instances through its SmartFactoryBean.isPrototype() method. Plain FactoryBean implementations which do not implement this extended interface are simply assumed to always return independent instances if the isSingleton() implementation returns false.

        The default implementation returns true, since a FactoryBean typically manages a singleton instance.

        指定者:
        isSingleton 在接口中 FactoryBean<Registry>
        返回:
        whether the exposed object is a singleton
        另请参阅:
        FactoryBean.getObject(), SmartFactoryBean.isPrototype()