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


Java BadRequestException类代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.webapp.BadRequestException的典型用法代码示例。如果您正苦于以下问题:Java BadRequestException类的具体用法?Java BadRequestException怎么用?Java BadRequestException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BadRequestException类属于org.apache.hadoop.yarn.webapp包,在下文中一共展示了BadRequestException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNodeContainer

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/containers/{containerid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContainerInfo getNodeContainer(@PathParam("containerid") String id) {
  ContainerId containerId = null;
  init();
  try {
    containerId = ConverterUtils.toContainerId(id);
  } catch (Exception e) {
    throw new BadRequestException("invalid container id, " + id);
  }

  Container container = nmContext.getContainers().get(containerId);
  if (container == null) {
    throw new NotFoundException("container with id, " + id + ", not found");
  }
  return new ContainerInfo(this.nmContext, container, uriInfo.getBaseUri()
      .toString(), webapp.name());

}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:NMWebServices.java

示例2: validateStates

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
private static void
    validateStates(String stateQuery, Set<String> statesQuery) {
  // stateQuery is deprecated.
  if (stateQuery != null && !stateQuery.isEmpty()) {
    statesQuery.add(stateQuery);
  }
  Set<String> appStates = parseQueries(statesQuery, true);
  for (String appState : appStates) {
    switch (YarnApplicationState.valueOf(
        StringUtils.toUpperCase(appState))) {
      case FINISHED:
      case FAILED:
      case KILLED:
        continue;
      default:
        throw new BadRequestException("Invalid application-state " + appState
            + " specified. It should be a final state");
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:AHSWebServices.java

示例3: getJobTasks

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/jobs/{jobid}/tasks")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public TasksInfo getJobTasks(@Context HttpServletRequest hsr,
    @PathParam("jobid") String jid, @QueryParam("type") String type) {

  init();
  Job job = getJobFromJobIdString(jid, appCtx);
  checkAccess(job, hsr);
  TasksInfo allTasks = new TasksInfo();
  for (Task task : job.getTasks().values()) {
    TaskType ttype = null;
    if (type != null && !type.isEmpty()) {
      try {
        ttype = MRApps.taskType(type);
      } catch (YarnRuntimeException e) {
        throw new BadRequestException("tasktype must be either m or r");
      }
    }
    if (ttype != null && task.getType() != ttype) {
      continue;
    }
    allTasks.add(new TaskInfo(task));
  }
  return allTasks;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:AMWebServices.java

示例4: getJobTasks

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/mapreduce/jobs/{jobid}/tasks")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public TasksInfo getJobTasks(@Context HttpServletRequest hsr,
    @PathParam("jobid") String jid, @QueryParam("type") String type) {

  init();
  Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
  checkAccess(job, hsr);
  TasksInfo allTasks = new TasksInfo();
  for (Task task : job.getTasks().values()) {
    TaskType ttype = null;
    if (type != null && !type.isEmpty()) {
      try {
        ttype = MRApps.taskType(type);
      } catch (YarnRuntimeException e) {
        throw new BadRequestException("tasktype must be either m or r");
      }
    }
    if (ttype != null && task.getType() != ttype) {
      continue;
    }
    allTasks.add(new TaskInfo(task));
  }
  return allTasks;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:HsWebServices.java

示例5: getNodeContainer

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/containers/{containerid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContainerInfo getNodeContainer(@javax.ws.rs.core.Context
    HttpServletRequest hsr, @PathParam("containerid") String id) {
  ContainerId containerId = null;
  init();
  try {
    containerId = ConverterUtils.toContainerId(id);
  } catch (Exception e) {
    throw new BadRequestException("invalid container id, " + id);
  }

  Container container = nmContext.getContainers().get(containerId);
  if (container == null) {
    throw new NotFoundException("container with id, " + id + ", not found");
  }
  return new ContainerInfo(this.nmContext, container, uriInfo.getBaseUri()
      .toString(), webapp.name(), hsr.getRemoteUser());

}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:NMWebServices.java

示例6: postEntities

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
/**
 * Store the given entities into the timeline store, and return the errors
 * that happen during storing.
 */
@POST
@Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */})
public TimelinePutResponse postEntities(
    @Context HttpServletRequest req,
    @Context HttpServletResponse res,
    TimelineEntities entities) {
  init(res);
  UserGroupInformation callerUGI = getUser(req);
  if (callerUGI == null) {
    String msg = "The owner of the posted timeline entities is not set";
    LOG.error(msg);
    throw new ForbiddenException(msg);
  }
  try {
    return timelineDataManager.postEntities(entities, callerUGI);
  } catch (BadRequestException bre) {
    throw bre;
  } catch (Exception e) {
    LOG.error("Error putting entities", e);
    throw new WebApplicationException(e,
        Response.Status.INTERNAL_SERVER_ERROR);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:28,代码来源:TimelineWebServices.java

示例7: validateStates

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
private static void
    validateStates(String stateQuery, Set<String> statesQuery) {
  // stateQuery is deprecated.
  if (stateQuery != null && !stateQuery.isEmpty()) {
    statesQuery.add(stateQuery);
  }
  Set<String> appStates = parseQueries(statesQuery, true);
  for (String appState : appStates) {
    switch (YarnApplicationState.valueOf(appState.toUpperCase())) {
      case FINISHED:
      case FAILED:
      case KILLED:
        continue;
      default:
        throw new BadRequestException("Invalid application-state " + appState
            + " specified. It should be a final state");
    }
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:20,代码来源:AHSWebServices.java

示例8: getJobTasks

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/mapreduce/jobs/{jobid}/tasks")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public TasksInfo getJobTasks(@PathParam("jobid") String jid,
    @QueryParam("type") String type) {

  init();
  Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
  TasksInfo allTasks = new TasksInfo();
  for (Task task : job.getTasks().values()) {
    TaskType ttype = null;
    if (type != null && !type.isEmpty()) {
      try {
        ttype = MRApps.taskType(type);
      } catch (YarnRuntimeException e) {
        throw new BadRequestException("tasktype must be either m or r");
      }
    }
    if (ttype != null && task.getType() != ttype) {
      continue;
    }
    allTasks.add(new TaskInfo(task));
  }
  return allTasks;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:HsWebServices.java

示例9: parseApplicationId

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
public static ApplicationId parseApplicationId(RecordFactory recordFactory,
    String appId) {
  if (appId == null || appId.isEmpty()) {
    throw new NotFoundException("appId, " + appId + ", is empty or null");
  }
  ApplicationId aid = null;
  try {
    aid = ApplicationId.fromString(appId);
  } catch (Exception e) {
    throw new BadRequestException(e);
  }
  if (aid == null) {
    throw new NotFoundException("app with id " + appId + " not found");
  }
  return aid;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:17,代码来源:WebAppUtils.java

示例10: parseApplicationAttemptId

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
protected static ApplicationAttemptId parseApplicationAttemptId(
    String appAttemptId) {
  if (appAttemptId == null || appAttemptId.isEmpty()) {
    throw new NotFoundException("appAttemptId, " + appAttemptId
        + ", is empty or null");
  }
  ApplicationAttemptId aaid = null;
  try {
    aaid = ApplicationAttemptId.fromString(appAttemptId);
  } catch (Exception e) {
    throw new BadRequestException(e);
  }
  if (aaid == null) {
    throw new NotFoundException("appAttemptId is null");
  }
  return aaid;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:18,代码来源:WebServices.java

示例11: parseContainerId

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
protected static ContainerId parseContainerId(String containerId) {
  if (containerId == null || containerId.isEmpty()) {
    throw new NotFoundException("containerId, " + containerId
        + ", is empty or null");
  }
  ContainerId cid = null;
  try {
    cid = ContainerId.fromString(containerId);
  } catch (Exception e) {
    throw new BadRequestException(e);
  }
  if (cid == null) {
    throw new NotFoundException("containerId is null");
  }
  return cid;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:17,代码来源:WebServices.java

示例12: getNodeContainer

import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/containers/{containerid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContainerInfo getNodeContainer(@javax.ws.rs.core.Context
    HttpServletRequest hsr, @PathParam("containerid") String id) {
  ContainerId containerId = null;
  init();
  try {
    containerId = ContainerId.fromString(id);
  } catch (Exception e) {
    throw new BadRequestException("invalid container id, " + id);
  }

  Container container = nmContext.getContainers().get(containerId);
  if (container == null) {
    throw new NotFoundException("container with id, " + id + ", not found");
  }
  return new ContainerInfo(this.nmContext, container, uriInfo.getBaseUri()
      .toString(), webapp.name(), hsr.getRemoteUser());

}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:22,代码来源:NMWebServices.java


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