code: public static Registry createRegistry(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
  		synchronized(registryCache) {
  			Integer portObj = port;
  			Registry registry = registryCache.get(portObj);
  			if(registry==null) {
  				registry = LocateRegistry.createRegistry(port, csf, ssf);
  				registryCache.put(portObj, registry);
  			}
  			return registry;
  		}
  	}
docs: Creates a registry or returns the registry that is already using the port.