/** * Creates an instance of {@link MasterInquireClient} based on the current configuration. The * returned instance may be shared, so it should not be closed by callers of this method. * * @return a master inquire client */ public static MasterInquireClient create() { return create(Configuration.global()); }
/** * Helper method to get the {@link InetSocketAddress} address for client to communicate with the * service. * * @param service the service name used to connect * @return the service address that a client (typically outside the service machine) uses to * communicate with service. */ public static InetSocketAddress getConnectAddress(ServiceType service) { return getConnectAddress(service, Configuration.global()); }
/** * Gets the port number on a given service type. If user defined port number is not explicitly * specified, Alluxio will use the default service port. * * @param service Service type used to connect * @return the service port number */ public static int getPort(ServiceType service) { return getPort(service, Configuration.global()); }
return getConnectHost(service, Configuration.global());
/** * Resets the client pools to the original state. */ protected void resetClientPools() throws IOException { Configuration.set(PropertyKey.USER_METRICS_COLLECTION_ENABLED, false); FileSystemContext.clearCache(); FileSystemContext.get().reset(Configuration.global()); }
/** * Checks whether the connect details from the uri + hadoop conf + global Alluxio conf are the * same as the connect details currently being used by {@link FileSystemContext}. * * @param uri the uri * @param conf the hadoop conf * @return whether the details match */ private boolean connectDetailsMatch(URI uri, org.apache.hadoop.conf.Configuration conf) { // Create the master inquire client that we would have after merging the hadoop conf into // Alluxio Configuration. AlluxioConfiguration alluxioConf = new InstancedConfiguration(Configuration.global()); HadoopConfigurationUtils.mergeHadoopConfiguration(conf, alluxioConf); ConnectDetails newDetails = Factory.getConnectDetails(alluxioConf); return newDetails.equals(FileSystemContext.get().getMasterInquireClient().getConnectDetails()); }
/** * Starts both master and a worker using the configurations in test conf respectively. */ public void start() throws Exception { // Disable HDFS client caching to avoid file system close() affecting other clients System.setProperty("fs.hdfs.impl.disable.cache", "true"); resetClientPools(); setupTest(); startMasters(); // Reset the file system context to make sure the correct master RPC port is used. FileSystemContext.get().reset(Configuration.global()); startWorkers(); startProxy(); // Reset contexts so that they pick up the updated configuration. reset(); }