List of usage examples for java.rmi.server RMISocketFactory getDefaultSocketFactory
public synchronized static RMISocketFactory getDefaultSocketFactory()
From source file:net.sf.ehcache.distribution.RMICachePeer.java
/** * Construct a new remote peer./*from ww w .j a v a2 s. co m*/ * * @param cache The cache attached to the peer * @param hostName The host name the peer is running on. * @param rmiRegistryPort The port number on which the RMI Registry listens. Should be an unused port in * the range 1025 - 65536 * @param remoteObjectPort the port number on which the remote objects bound in the registry receive calls. * This defaults to a free port if not specified. * Should be an unused port in the range 1025 - 65536 * @param socketTimeoutMillis * @throws RemoteException */ public RMICachePeer(Ehcache cache, String hostName, Integer rmiRegistryPort, Integer remoteObjectPort, Integer socketTimeoutMillis) throws RemoteException { super(remoteObjectPort.intValue(), new ConfigurableRMIClientSocketFactory(socketTimeoutMillis), RMISocketFactory.getDefaultSocketFactory()); this.remoteObjectPort = remoteObjectPort; this.hostname = hostName; this.rmiRegistryPort = rmiRegistryPort; this.cache = cache; }
From source file:com.vmware.identity.idm.server.IdmServer.java
/** * Initialize the IDM service.//from w w w .ja va2 s . co m * * @throws Exception when something goes wrong with initialization. */ private static void initialize() throws Exception { try (IDiagnosticsContextScope diagCtxt = DiagnosticsContextFactory.createContext("IDM Startup", "")) { logger.info("Starting IDM Server..."); logger.debug("Creating RMI registry on port {}", Tenant.RMI_PORT); boolean allowRemoteConnections = Boolean .parseBoolean(System.getProperty(ALLOW_REMOTE_PROPERTY, "false")); if (allowRemoteConnections) { logger.warn("RMI registry is allowing remote connections!"); registry = LocateRegistry.createRegistry(Tenant.RMI_PORT); } else { logger.debug("RMI registry is restricted to the localhost"); RMIClientSocketFactory csf = RMISocketFactory.getDefaultSocketFactory(); RMIServerSocketFactory ssf = new LocalRMIServerSocketFactory(); registry = LocateRegistry.createRegistry(Tenant.RMI_PORT, csf, ssf); } // Assign a security manager, in the event that dynamic classes are loaded if (System.getSecurityManager() == null) { logger.debug("Creating RMI Security Manager..."); System.setSecurityManager(new RMISecurityManager()); } logger.debug("Creating Config Store factory..."); IConfigStoreFactory cfgStoreFactory = new ConfigStoreFactory(); logger.debug("Creating Identity Provider factory..."); IProviderFactory providerFactory = new ProviderFactory(); logger.debug("Checking VMware Directory Service..."); ServerUtils.check_directory_service(); logger.debug("Setting system properties..."); System.setProperties(new ThreadLocalProperties(System.getProperties())); logger.debug("Creating Identity Manager instance..."); manager = new IdentityManager(cfgStoreFactory, providerFactory); String rmiAddress = String.format("rmi://localhost:%d/%s", Tenant.RMI_PORT, IDENTITY_MANAGER_BIND_NAME); logger.debug("Binding to RMI address '{}'", rmiAddress); loginManager = new IdmLoginManager(manager); ILoginManager stub = (ILoginManager) UnicastRemoteObject.exportObject(loginManager, 0); Naming.rebind(rmiAddress, stub); startHeartbeat(); logger.info(VmEvent.SERVER_STARTED, "IDM Server has started"); } catch (Throwable t) { logger.error(VmEvent.SERVER_FAILED_TOSTART, "IDM Server has failed to start", t); throw t; } }
From source file:org.apache.cassandra.tools.NodeProbe.java
private RMIClientSocketFactory getRMIClientSocketFactory() throws IOException { if (Boolean.parseBoolean(System.getProperty("ssl.enable"))) return new SslRMIClientSocketFactory(); else//www . j a va 2 s .c om return RMISocketFactory.getDefaultSocketFactory(); }