@SuppressWarnings("unchecked") public RegistryContext(String host,int port,Hashtable<?,?> env) throws NamingException {
  environment=(env == null) ? new Hashtable<String,Object>(5) : (Hashtable<String,Object>)env;
  if (environment.get(SECURITY_MGR) != null) {
    installSecurityMgr();
  }
  if ((host != null) && (host.charAt(0) == '[')) {
    host=host.substring(1,host.length() - 1);
  }
  RMIClientSocketFactory socketFactory=(RMIClientSocketFactory)environment.get(SOCKET_FACTORY);
  registry=getRegistry(host,port,socketFactory);
  this.host=host;
  this.port=port;
}

@ SuppressWarnings ( "unchecked" ) public RegistryContext ( String host , int port , Hashtable < ? , ? > env ) throws NamingException { environment = ( env == null ) ? new Hashtable < String , Object > ( 5 ) : ( Hashtable < String , Object > ) env ; if ( environment . get ( SECURITY_MGR ) != null ) { installSecurityMgr ( ) ; } if ( ( host != null ) && ( host . charAt ( 0 ) == '[' ) ) { host = host . substring ( 1 , host . length ( ) - 1 ) ; } RMIClientSocketFactory socketFactory = ( RMIClientSocketFactory ) environment . get ( SOCKET_FACTORY ) ; registry = getRegistry ( host , port , socketFactory ) ; this . host = host ; this . port = port ; }
returns a context for the registry at a given host and port . if " host " is null , uses default host . if " port " is non - positive , uses default port . cloning of " env " is handled by caller ; see comments within registrycontextfactory . getobjectinstance ( ) , for example .
