Java Code Examples for org.apache.hadoop.ipc.RPC#waitForProxy()

The following examples show how to use org.apache.hadoop.ipc.RPC#waitForProxy() . 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: DirectTaskUmbilical.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public static DirectTaskUmbilical createDirectUmbilical(
  TaskUmbilicalProtocol taskTracker,
  InetSocketAddress jobTrackerAddress, JobConf conf) throws IOException {

  LOG.info("Creating direct umbilical to " + jobTrackerAddress.toString());
  long jtConnectTimeoutMsec = conf.getLong(
    "corona.jobtracker.connect.timeout.msec", 60000L);
  int rpcTimeout = (int) jtConnectTimeoutMsec;

  InterTrackerProtocol jobClient = RPC.waitForProxy(
    InterTrackerProtocol.class,
    InterTrackerProtocol.versionID,
    jobTrackerAddress,
    conf,
    jtConnectTimeoutMsec,
    rpcTimeout);

  return new DirectTaskUmbilical(taskTracker, jobClient);
}
 
Example 2
Source File: TestNameNodePorts.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public void testSinglePortStartup() throws IOException {
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = new MiniDFSCluster(conf, 2, true, null);
  NameNode nn = cluster.getNameNode();
  InetSocketAddress dnAddress = nn.getNameNodeDNAddress();
  InetSocketAddress clientAddress = nn.getNameNodeAddress();

  assertEquals(clientAddress, dnAddress);

  DatanodeProtocol dnProtocol = (DatanodeProtocol) RPC.waitForProxy(
      DatanodeProtocol.class, DatanodeProtocol.versionID, dnAddress, conf);
  // perform a dummy call
  dnProtocol.getProtocolVersion(DatanodeProtocol.class.getName(),
      DatanodeProtocol.versionID);
  ClientProtocol client = (ClientProtocol) RPC.waitForProxy(
      ClientProtocol.class, ClientProtocol.versionID, dnAddress, conf);
  client.getProtocolVersion(ClientProtocol.class.getName(),
      ClientProtocol.versionID);

  cluster.shutdown();
}
 
Example 3
Source File: CoronaJobTracker.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public ParentHeartbeat(
  Configuration conf,
  TaskAttemptID attemptId,
  InetSocketAddress myAddr,
  InetSocketAddress parentAddr,
  String sessionId) throws IOException {
  this.attemptId = attemptId;
  this.myAddr = myAddr;
  this.parentAddr = parentAddr;
  this.sessionId = sessionId;
  long connectTimeout = RemoteJTProxy.getRemotJTTimeout(conf);
  parent = RPC.waitForProxy(
      InterCoronaJobTrackerProtocol.class,
      InterCoronaJobTrackerProtocol.versionID,
      parentAddr,
      conf,
      connectTimeout);
}
 
Example 4
Source File: DataNode.java    From RDFS with Apache License 2.0 6 votes vote down vote up
void setupNS(Configuration conf, AbstractList<File> dataDirs) 
throws IOException {
  // get NN proxy
  DatanodeProtocol dnp = 
    (DatanodeProtocol)RPC.waitForProxy(DatanodeProtocol.class,
        DatanodeProtocol.versionID, nnAddr, conf);
  setNameNode(dnp);

  // handshake with NN
  NamespaceInfo nsInfo = handshake();
  setNamespaceInfo(nsInfo);
  synchronized(DataNode.this){
    setupNSStorage();
  }
  
  nsRegistration.setIpcPort(ipcServer.getListenerAddress().getPort());
  nsRegistration.setInfoPort(infoServer.getPort());
}
 
Example 5
Source File: TaskTracker.java    From RDFS with Apache License 2.0 5 votes vote down vote up
protected void initJobClient(JobConf conf) throws IOException {
  this.jobTrackAddr = JobTracker.getAddress(conf);
  this.jobClient = (InterTrackerProtocol)
  RPC.waitForProxy(InterTrackerProtocol.class,
      InterTrackerProtocol.versionID,
      jobTrackAddr,conf);
}
 
Example 6
Source File: RemoteJTProxy.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 * Create the RPC client to the remote corona job tracker.
 * @param host The host running the remote corona job tracker.
 * @param port The port of the remote corona job tracker.
 * @param sessionId The session for the remote corona job tracker.
 * @throws IOException
 */
void initializeClientUnprotected(String host, int port, String sessionId)
  throws IOException {
  if (client != null) {
    return;
  }
  LOG.info("Creating JT client to " + host + ":" + port);
  client = RPC.waitForProxy(JobSubmissionProtocol.class,
      JobSubmissionProtocol.versionID, new InetSocketAddress(host, port),
      conf);
  remoteSessionId = sessionId;
}
 
Example 7
Source File: CoronaJobTracker.java    From RDFS with Apache License 2.0 5 votes vote down vote up
private void reportJobStats() {
  if (job == null) {
    return;
  }
  Counters jobCounters = job.getCounters();
  JobStats jobStats = job.getJobStats();
  String pool = null;
  if (sessionDriver != null) {
    pool = PoolInfo.createStringFromPoolInfo(sessionDriver.getPoolInfo());
  }
  try {
    CoronaConf coronaConf = new CoronaConf(conf);
    InetSocketAddress aggregatorAddr = NetUtils.createSocketAddr(
      coronaConf.getProxyJobTrackerAddress());
    long timeout = 5000; // Can make configurable later.
    CoronaJobAggregator aggregator = RPC.waitForProxy(
      CoronaJobAggregator.class,
      CoronaJobAggregator.versionID,
      aggregatorAddr,
      conf,
      timeout);
    LOG.info("Reporting job stats with jobId=" + jobId +
      ", pool=" + pool + ", jobStats=" + jobStats + ", " +
      "jobCounters=" + jobCounters);
    aggregator.reportJobStats(jobId.toString(), pool, jobStats, jobCounters);
  } catch (IOException e) {
    LOG.warn("Ignoring error in reportJobStats ", e);
  }
}