当前位置: 首页>>代码示例>>Java>>正文


Java DataInputByteBuffer.readInt方法代码示例

本文整理汇总了Java中org.apache.hadoop.io.DataInputByteBuffer.readInt方法的典型用法代码示例。如果您正苦于以下问题:Java DataInputByteBuffer.readInt方法的具体用法?Java DataInputByteBuffer.readInt怎么用?Java DataInputByteBuffer.readInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.io.DataInputByteBuffer的用法示例。


在下文中一共展示了DataInputByteBuffer.readInt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserializeMetaData

import org.apache.hadoop.io.DataInputByteBuffer; //导入方法依赖的package包/类
/**
 * A helper function to deserialize the metadata returned by ShuffleHandler.
 * @param meta the metadata returned by the ShuffleHandler
 * @return the port the Shuffle Handler is listening on to serve shuffle data.
 */
public static int deserializeMetaData(ByteBuffer meta) throws IOException {
  //TODO this should be returning a class not just an int
  DataInputByteBuffer in = new DataInputByteBuffer();
  in.reset(meta);
  int port = in.readInt();
  return port;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:ShuffleHandler.java

示例2: deserializeMetaData

import org.apache.hadoop.io.DataInputByteBuffer; //导入方法依赖的package包/类
/**
 * A helper function to deserialize the metadata returned by PullServerAuxService.
 * @param meta the metadata returned by the PullServerAuxService
 * @return the port the PullServer Handler is listening on to serve shuffle data.
 */
public static int deserializeMetaData(ByteBuffer meta) throws IOException {
  //TODO this should be returning a class not just an int
  DataInputByteBuffer in = new DataInputByteBuffer();
  in.reset(meta);
  return in.readInt();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:12,代码来源:TajoPullServerService.java

示例3: deserializeShuffleProviderMetaData

import org.apache.hadoop.io.DataInputByteBuffer; //导入方法依赖的package包/类
public static int deserializeShuffleProviderMetaData(ByteBuffer meta)
    throws IOException {
  DataInputByteBuffer in = new DataInputByteBuffer();
  try {
    in.reset(meta);
    int port = in.readInt();
    return port;
  } finally {
    in.close();
  }
}
 
开发者ID:apache,项目名称:incubator-tez,代码行数:12,代码来源:ShuffleUtils.java

示例4: launch

import org.apache.hadoop.io.DataInputByteBuffer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void launch(ContainerLaunchRequest event) {
  LOG.info("Launching " + event.getContainerId());
  if(this.state == ContainerState.KILLED_BEFORE_LAUNCH) {
    state = ContainerState.DONE;
    sendContainerLaunchFailedMsg(event.getContainerId(),
        "Container was killed before it was launched");
    return;
  }

  ContainerManagementProtocolProxyData proxy = null;
  try {

    proxy = getCMProxy(containerID, containerMgrAddress,
        containerToken);

    // Construct the actual Container
    ContainerLaunchContext containerLaunchContext =
      event.getContainerLaunchContext();

    // Now launch the actual container
    StartContainerRequest startRequest = Records
      .newRecord(StartContainerRequest.class);
    startRequest.setContainerToken(event.getContainerToken());
    startRequest.setContainerLaunchContext(containerLaunchContext);

    StartContainersResponse response =
        proxy.getContainerManagementProtocol().startContainers(
            StartContainersRequest.newInstance(
                Collections.singletonList(startRequest)));
    if (response.getFailedRequests() != null
        && !response.getFailedRequests().isEmpty()) {
      throw response.getFailedRequests().get(containerID).deSerialize();
    }

    // after launching, send launched event to task attempt to move
    // it from ASSIGNED to RUNNING state
    getContext().containerLaunched(containerID);
    this.state = ContainerState.RUNNING;

    int shufflePort = TezRuntimeUtils.INVALID_PORT;
    Map<String, java.nio.ByteBuffer> servicesMetaData = response.getAllServicesMetaData();
    if (servicesMetaData != null) {
      String auxiliaryService = conf.get(TezConfiguration.TEZ_AM_SHUFFLE_AUXILIARY_SERVICE_ID,
          TezConfiguration.TEZ_AM_SHUFFLE_AUXILIARY_SERVICE_ID_DEFAULT);
      ByteBuffer portInfo = servicesMetaData.get(auxiliaryService);
      if (portInfo != null) {
        DataInputByteBuffer in = new DataInputByteBuffer();
        in.reset(portInfo);
        shufflePort = in.readInt();
      } else {
        LOG.warn("Shuffle port for {} is not present is the services metadata response", auxiliaryService);
      }
    } else {
      LOG.warn("Shuffle port cannot be found since services metadata response is missing");
    }
    if (deletionTracker != null) {
      deletionTracker.addNodeShufflePort(event.getNodeId(), shufflePort);
    }
  } catch (Throwable t) {
    String message = "Container launch failed for " + containerID + " : "
        + ExceptionUtils.getStackTrace(t);
    this.state = ContainerState.FAILED;
    sendContainerLaunchFailedMsg(containerID, message);
  } finally {
    if (proxy != null) {
      cmProxy.mayBeCloseProxy(proxy);
    }
  }
}
 
开发者ID:apache,项目名称:tez,代码行数:71,代码来源:TezContainerLauncherImpl.java


注:本文中的org.apache.hadoop.io.DataInputByteBuffer.readInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。