Class RMIObject

    • Constructor Detail

      • RMIObject

        public RMIObject​(URL registryURL,
                         String bindingKey)
                  throws RemoteException,
                         AlreadyBoundException
        Register this object in the RMI registry. When the host has not been specified in the URL, 127.0.0.1 will be used. When the port has not been specified in the URL, the default RMI port 1099 will be used. When the RMI registry does not exist yet, it will be created, but only on the local host. Remote creation of a registry on another computer is not possible. Any attempt to do so will cause an AccessException to be fired.
        Parameters:
        registryURL - URL; the URL of the registry, e.g., "http://localhost:1099" or "http://130.161.185.14:28452"
        bindingKey - String; the key under which this object will be bound in the RMI registry
        Throws:
        RemoteException - when there is a problem with the RMI registry
        AlreadyBoundException - when there is already another object bound to the bindingKey
        NullPointerException - when registryURL or bindingKey is null
        AccessException - when there is an attempt to create a registry on a remote host
      • RMIObject

        public RMIObject​(String host,
                         int port,
                         String bindingKey)
                  throws RemoteException,
                         AlreadyBoundException
        Register this object in the RMI registry. When the RMI registry does not exist yet, it will be created, but only on the local host. Remote creation of a registry on another computer is not possible. Any attempt to do so will cause an AccessException to be fired.
        Parameters:
        host - String; the host where the RMI registry resides or will be created. Creation is only possible on localhost.
        port - int; the port where the RMI registry can be found or will be created
        bindingKey - String; the key under which this object will be bound in the RMI registry
        Throws:
        RemoteException - when there is a problem with the RMI registry
        AlreadyBoundException - when there is already another object bound to the bindingKey
        NullPointerException - when host, path, or bindingKey is null
        IllegalArgumentException - when port < 0 or port > 65535
        AccessException - when there is an attempt to create a registry on a remote host
    • Method Detail

      • register

        protected void register​(String host,
                                int port,
                                String bindingKey)
                         throws RemoteException,
                                AlreadyBoundException
        Register this object in the RMI registry. When the RMI registry does not exist yet, it will be created, but only on the local host. Remote creation of a registry on another computer is not possible. Any attempt to do so will cause an AccessException to be fired.
        Parameters:
        host - String; the host where the RMI registry resides or will be created. Creation is only possible on localhost.
        port - int; the port where the RMI registry can be found or will be created
        bindingKey - String; the key under which this object will be bound in the RMI registry
        Throws:
        RemoteException - when there is a problem with the RMI registry
        AlreadyBoundException - when there is already another object bound to the bindingKey
        AccessException - when there is an attempt to create a registry on a remote host
      • getRegistry

        public Registry getRegistry()
        Returns the registry in which this object has been bound, e.g., to look up other objects in the registry.
        Returns:
        Registry; the registry in which this object has been bound