/** * Locate or create the RMI registry. * @param registryHost the registry host to use (if this is specified, * no implicit creation of a RMI registry will happen) * @param registryPort the registry port to use * @param clientSocketFactory the RMI client socket factory for the registry (if any) * @param serverSocketFactory the RMI server socket factory for the registry (if any) * @return the RMI registry * @throws java.rmi.RemoteException if the registry couldn't be located or created */ protected Registry getRegistry(String registryHost, int registryPort, @Nullable RMIClientSocketFactory clientSocketFactory, @Nullable RMIServerSocketFactory serverSocketFactory) throws RemoteException { if (registryHost != null) { // Host explicitly specified: only lookup possible. if (logger.isDebugEnabled()) { logger.debug("Looking for RMI registry at port '" + registryPort + "' of host [" + registryHost + "]"); } Registry reg = LocateRegistry.getRegistry(registryHost, registryPort, clientSocketFactory); testRegistry(reg); return reg; } else { return getRegistry(registryPort, clientSocketFactory, serverSocketFactory); } }
@Override public void afterPropertiesSet() throws Exception { // Check socket factories for registry. if (this.clientSocketFactory instanceof RMIServerSocketFactory) { this.serverSocketFactory = (RMIServerSocketFactory) this.clientSocketFactory; } if ((this.clientSocketFactory != null && this.serverSocketFactory == null) || (this.clientSocketFactory == null && this.serverSocketFactory != null)) { throw new IllegalArgumentException( "Both RMIClientSocketFactory and RMIServerSocketFactory or none required"); } // Fetch RMI registry to expose. this.registry = getRegistry(this.host, this.port, this.clientSocketFactory, this.serverSocketFactory); }
testRegistry(reg); return reg;
@Override public void afterPropertiesSet() throws Exception { if (enabled) { super.afterPropertiesSet(); } }
@Override public void afterPropertiesSet() throws Exception { // Check socket factories for registry. if (this.clientSocketFactory instanceof RMIServerSocketFactory) { this.serverSocketFactory = (RMIServerSocketFactory) this.clientSocketFactory; } if ((this.clientSocketFactory != null && this.serverSocketFactory == null) || (this.clientSocketFactory == null && this.serverSocketFactory != null)) { throw new IllegalArgumentException( "Both RMIClientSocketFactory and RMIServerSocketFactory or none required"); } // Fetch RMI registry to expose. this.registry = getRegistry(this.host, this.port, this.clientSocketFactory, this.serverSocketFactory); }
testRegistry(reg); return reg;
@Override public void afterPropertiesSet() throws Exception { if (enabled) { super.afterPropertiesSet(); } }
testRegistry(reg); return reg; return getRegistry(registryPort);
@Override protected Registry getRegistry(int registryPort) throws RemoteException { if(enabled) { return super.getRegistry(registryPort); } else { throw new RemoteException(ERR_MSG_NOT_ENABLED); } } }
testRegistry(reg); return reg;
/** * Locate or create the RMI registry. * @param registryHost the registry host to use (if this is specified, * no implicit creation of a RMI registry will happen) * @param registryPort the registry port to use * @param clientSocketFactory the RMI client socket factory for the registry (if any) * @param serverSocketFactory the RMI server socket factory for the registry (if any) * @return the RMI registry * @throws java.rmi.RemoteException if the registry couldn't be located or created */ protected Registry getRegistry(String registryHost, int registryPort, @Nullable RMIClientSocketFactory clientSocketFactory, @Nullable RMIServerSocketFactory serverSocketFactory) throws RemoteException { if (registryHost != null) { // Host explicitly specified: only lookup possible. if (logger.isDebugEnabled()) { logger.debug("Looking for RMI registry at port '" + registryPort + "' of host [" + registryHost + "]"); } Registry reg = LocateRegistry.getRegistry(registryHost, registryPort, clientSocketFactory); testRegistry(reg); return reg; } else { return getRegistry(registryPort, clientSocketFactory, serverSocketFactory); } }
@Override protected Registry getRegistry(int registryPort) throws RemoteException { if(enabled) { return super.getRegistry(registryPort); } else { throw new RemoteException(ERR_MSG_NOT_ENABLED); } } }
testRegistry(reg); return reg; return getRegistry(registryPort);
@Override protected Registry getRegistry( int registryPort, RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory) throws RemoteException { if(enabled) { return super.getRegistry(registryPort, clientSocketFactory, serverSocketFactory); } else { throw new RemoteException(ERR_MSG_NOT_ENABLED); } }
/** * Locate or create the RMI registry. * @param registryHost the registry host to use (if this is specified, * no implicit creation of a RMI registry will happen) * @param registryPort the registry port to use * @param clientSocketFactory the RMI client socket factory for the registry (if any) * @param serverSocketFactory the RMI server socket factory for the registry (if any) * @return the RMI registry * @throws java.rmi.RemoteException if the registry couldn't be located or created */ protected Registry getRegistry(String registryHost, int registryPort, @Nullable RMIClientSocketFactory clientSocketFactory, @Nullable RMIServerSocketFactory serverSocketFactory) throws RemoteException { if (registryHost != null) { // Host explicitly specified: only lookup possible. if (logger.isDebugEnabled()) { logger.debug("Looking for RMI registry at port '" + registryPort + "' of host [" + registryHost + "]"); } Registry reg = LocateRegistry.getRegistry(registryHost, registryPort, clientSocketFactory); testRegistry(reg); return reg; } else { return getRegistry(registryPort, clientSocketFactory, serverSocketFactory); } }
@Override public void afterPropertiesSet() throws Exception { // Check socket factories for registry. if (this.clientSocketFactory instanceof RMIServerSocketFactory) { this.serverSocketFactory = (RMIServerSocketFactory) this.clientSocketFactory; } if ((this.clientSocketFactory != null && this.serverSocketFactory == null) || (this.clientSocketFactory == null && this.serverSocketFactory != null)) { throw new IllegalArgumentException( "Both RMIClientSocketFactory and RMIServerSocketFactory or none required"); } // Fetch RMI registry to expose. this.registry = getRegistry(this.host, this.port, this.clientSocketFactory, this.serverSocketFactory); }
testRegistry(reg); return reg; return getRegistry(registryPort);
@Override protected Registry getRegistry( int registryPort, RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory) throws RemoteException { if(enabled) { return super.getRegistry(registryPort, clientSocketFactory, serverSocketFactory); } else { throw new RemoteException(ERR_MSG_NOT_ENABLED); } }
@Override protected Registry getRegistry( String registryHost, int registryPort, RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory) throws RemoteException { if(enabled) { return super.getRegistry(registryHost, registryPort, clientSocketFactory, serverSocketFactory); } else { throw new RemoteException(ERR_MSG_NOT_ENABLED); } }
@Override protected Registry getRegistry( String registryHost, int registryPort, RMIClientSocketFactory clientSocketFactory, RMIServerSocketFactory serverSocketFactory) throws RemoteException { if(enabled) { return super.getRegistry(registryHost, registryPort, clientSocketFactory, serverSocketFactory); } else { throw new RemoteException(ERR_MSG_NOT_ENABLED); } }