private Registry getPrivateRegistry()

in src/main/java/org/apache/sling/jcr/registration/impl/RmiRegistrationSupport.java [172:196]


    private Registry getPrivateRegistry() {
        if (this.registry == null) {
            try {
                // no, so try to create first
                this.registry = LocateRegistry.createRegistry(this.registryPort);
                this.registryIsPrivate = true;
                logger.info("Using private RMI Registry at {}", this.registryPort);

            } catch (RemoteException re) {
                // creating failed, check whether there is already one
                logger.info("Cannot create private registry, trying existing registry at {}, reason: {}", this.registryPort, re);

                try {
                    this.registry = LocateRegistry.getRegistry(this.registryPort);
                    this.registryIsPrivate = false;
                    logger.info("Trying existing registry at {}", this.registryPort);

                } catch (RemoteException pre) {
                    logger.error("Cannot get existing registry, will not register repositories on RMI", pre);
                }
            }
        }

        return this.registry;
    }