Java Code Examples for java.rmi.registry.Registry#REGISTRY_PORT

The following examples show how to use java.rmi.registry.Registry#REGISTRY_PORT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Jstatd.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static void bind(String name, RemoteHostImpl remoteHost)
            throws RemoteException, MalformedURLException, Exception {

    try {
        Naming.rebind(name, remoteHost);
    } catch (java.rmi.ConnectException e) {
        /*
         * either the registry is not running or we cannot contact it.
         * start an internal registry if requested.
         */
        if (startRegistry && registry == null) {
            int localport = (port < 0) ? Registry.REGISTRY_PORT : port;
            registry = LocateRegistry.createRegistry(localport);
            bind(name, remoteHost);
        } else {
            throw e;
        }
    }
}
 
Example 2
Source File: RMIContext.java    From oodt with Apache License 2.0 6 votes vote down vote up
/**
 * Get the RMI registry.
 *
 * @return a <code>Registry</code> value.
 * @throws NamingException if an error occurs.
 */
private Registry getRegistry() throws NamingException {
	if (registry != null) {
	  return registry;
	}
	try {
		String host = environment.containsKey("host")? (String) environment.get("host") : "localhost";
		int port = environment.containsKey("port")? (Integer) environment.get("port")
			: Registry.REGISTRY_PORT;

		
		registry = LocateRegistry.getRegistry(host, port);
	} catch (RemoteException ex) {
		throw new NamingException("Remote exception locating registry: " + ex.getMessage());
	}
	return registry;
}
 
Example 3
Source File: ConnectToServerDialog.java    From openAGV with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param paramSets The list of connection param sets.
 */
public ConnectToServerDialog(List<ConnectionParamSet> paramSets) {
  super((JFrame) null, true);
  this.paramSets = requireNonNull(paramSets, "paramSets");

  initComponents();
  initConnectionBookmarks();

  if (paramSets.isEmpty()) {
    description = "Localhost";
    host = "localhost";
    port = Registry.REGISTRY_PORT;
  }
  else {
    description = paramSets.get(0).getDescription();
    host = paramSets.get(0).getHost();
    port = paramSets.get(0).getPort();
  }

  textFieldDescription.setText(description);
  textFieldServer.setText(host);
  textFieldPort.setText(String.valueOf(port));
  getRootPane().setDefaultButton(okButton);

  setIconImages(Icons.getOpenTCSIcons());
  setLocationRelativeTo(null);
  pack();
}
 
Example 4
Source File: ConnectionDescriptor.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
final HostIdentifier createHostIdentifier(Host host) {
    String hostId = null;
    if (this != DEFAULT_LOCAL_DESCRIPTOR) {
        hostId = "rmi://" + host.getHostName(); // NOI18N
        if (port != Registry.REGISTRY_PORT) hostId += ":" + port; // NOI18N
    }
    try {
        return new HostIdentifier(hostId);
    } catch (URISyntaxException e) {
        Exceptions.printStackTrace(e);
        return null;
    }
}
 
Example 5
Source File: ConnectionParamSet.java    From openAGV with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new instance for host "localhost" and port 1099.
 */
public ConnectionParamSet() {
  this("Localhost", "localhost", Registry.REGISTRY_PORT);
}
 
Example 6
Source File: ConnectionDescriptor.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
static ConnectionDescriptor createDefault() {
    return new ConnectionDescriptor(Registry.REGISTRY_PORT, GlobalPreferences.sharedInstance().getMonitoredHostPoll());
}
 
Example 7
Source File: JVoiceXmlRegistry.java    From JVoiceXML with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Constructs a new object.
 */
public JVoiceXmlRegistry() {
    port = Registry.REGISTRY_PORT;
}
 
Example 8
Source File: RMIRegistryService.java    From gemfirexd-oss with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor to configure RMI Registry to start using default RMI Registry 
 * port: {@link Registry#REGISTRY_PORT}
 */
public RMIRegistryService() {
  this(Registry.REGISTRY_PORT);
}
 
Example 9
Source File: RMIRegistryService.java    From gemfirexd-oss with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor to configure RMI Registry to start using default RMI Registry 
 * port: {@link Registry#REGISTRY_PORT}
 */
public RMIRegistryService() {
  this(Registry.REGISTRY_PORT);
}
 
Example 10
Source File: RemoteCacheClientTester.java    From commons-jcs with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor for the RemoteCacheClientTest object
 * @param count
 * @param write
 * @param read
 * @param delete
 * @throws MalformedURLException
 * @throws NotBoundException
 * @throws IOException
 */
public RemoteCacheClientTester( int count, boolean write, boolean read, boolean delete )
    throws MalformedURLException, NotBoundException, IOException
{
    this( "", Registry.REGISTRY_PORT, count, write, read, delete );
}