• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Lock类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: activateApplication

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
/**
 * An application has new outstanding requests.
 * 
 * @param user application user 
 * @param applicationId activated application
 */
@Lock({Queue.class, SchedulerApplicationAttempt.class})
synchronized public void activateApplication(
    String user, ApplicationId applicationId) {
  Set<ApplicationId> userApps = usersApplications.get(user);
  if (userApps == null) {
    userApps = new HashSet<ApplicationId>();
    usersApplications.put(user, userApps);
    ++activeUsers;
    metrics.incrActiveUsers();
    LOG.debug("User " + user + " added to activeUsers, currently: " + 
        activeUsers);
  }
  if (userApps.add(applicationId)) {
    metrics.activateApp(user);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:ActiveUsersManager.java


示例2: deactivateApplication

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
/**
 * An application has no more outstanding requests.
 * 
 * @param user application user 
 * @param applicationId deactivated application
 */
@Lock({Queue.class, SchedulerApplicationAttempt.class})
synchronized public void deactivateApplication(
    String user, ApplicationId applicationId) {
  Set<ApplicationId> userApps = usersApplications.get(user);
  if (userApps != null) {
    if (userApps.remove(applicationId)) {
      metrics.deactivateApp(user);
    }
    if (userApps.isEmpty()) {
      usersApplications.remove(user);
      --activeUsers;
      metrics.decrActiveUsers();
      LOG.debug("User " + user + " removed from activeUsers, currently: " + 
          activeUsers);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:ActiveUsersManager.java


示例3: reinitializeQueues

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
@Lock(CapacityScheduler.class)
private void reinitializeQueues(CapacitySchedulerConfiguration conf) 
throws IOException {
  // Parse new queues
  Map<String, CSQueue> newQueues = new HashMap<String, CSQueue>();
  CSQueue newRoot = 
      parseQueue(this, conf, null, CapacitySchedulerConfiguration.ROOT, 
          newQueues, queues, noop); 
  
  // Ensure all existing queues are still present
  validateExistingQueues(queues, newQueues);

  // Add new queues
  addNewQueues(queues, newQueues);
  
  // Re-configure queues
  root.reinitialize(newRoot, clusterResource);
  initializeQueueMappings();

  // Re-calculate headroom for active applications
  root.updateClusterResource(clusterResource, new ResourceLimits(
      clusterResource));

  labelManager.reinitializeQueueLabels(getQueueToLabels());
  setQueueAcls(authorizer, queues);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:CapacityScheduler.java


示例4: validateExistingQueues

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
/**
 * Ensure all existing queues are present. Queues cannot be deleted
 * @param queues existing queues
 * @param newQueues new queues
 */
@Lock(CapacityScheduler.class)
private void validateExistingQueues(
    Map<String, CSQueue> queues, Map<String, CSQueue> newQueues) 
throws IOException {
  // check that all static queues are included in the newQueues list
  for (Map.Entry<String, CSQueue> e : queues.entrySet()) {
    if (!(e.getValue() instanceof ReservationQueue)) {
      String queueName = e.getKey();
      CSQueue oldQueue = e.getValue();
      CSQueue newQueue = newQueues.get(queueName); 
      if (null == newQueue) {
        throw new IOException(queueName + " cannot be found during refresh!");
      } else if (!oldQueue.getQueuePath().equals(newQueue.getQueuePath())) {
        throw new IOException(queueName + " is moved from:"
            + oldQueue.getQueuePath() + " to:" + newQueue.getQueuePath()
            + " after refresh, which is not allowed.");
      }
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:CapacityScheduler.java


示例5: reinitializeQueues

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
@Lock(CapacityScheduler.class)
private void reinitializeQueues(CapacitySchedulerConfiguration conf) 
throws IOException {
  // Parse new queues
  Map<String, CSQueue> newQueues = new HashMap<String, CSQueue>();
  CSQueue newRoot = 
      parseQueue(this, conf, null, CapacitySchedulerConfiguration.ROOT, 
          newQueues, queues, noop); 
  
  // Ensure all existing queues are still present
  validateExistingQueues(queues, newQueues);

  // Add new queues
  addNewQueues(queues, newQueues);
  
  // Re-configure queues
  root.reinitialize(newRoot, clusterResource);
  updatePlacementRules();

  // Re-calculate headroom for active applications
  root.updateClusterResource(clusterResource, new ResourceLimits(
      clusterResource));

  labelManager.reinitializeQueueLabels(getQueueToLabels());
  setQueueAcls(authorizer, queues);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:CapacityScheduler.java


示例6: initializeQueues

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
@Lock(CapacityScheduler.class)
private void initializeQueues(CapacitySchedulerConfiguration conf)
  throws IOException {

  root = 
      parseQueue(this, conf, null, CapacitySchedulerConfiguration.ROOT, 
          queues, queues, noop);
  labelManager.reinitializeQueueLabels(getQueueToLabels());
  LOG.info("Initialized root queue " + root);
  //print all queue info
  for(String queueName : queues.keySet()){
  	LOG.info("queue name:"+queueName); 	
  }
  initializeQueueMappings();
  setQueueAcls(authorizer, queues);
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:17,代码来源:CapacityScheduler.java


示例7: validateExistingQueues

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
/**
 * Ensure all existing queues are present. Queues cannot be deleted
 * @param queues existing queues
 * @param newQueues new queues
 */
@Lock(CapacityScheduler.class)
private void validateExistingQueues(
    Map<String, CSQueue> queues, Map<String, CSQueue> newQueues) 
throws IOException {
  // check that all static queues are included in the newQueues list
  for (Map.Entry<String, CSQueue> e : queues.entrySet()) {
    if (!(e.getValue() instanceof ReservationQueue)) {
      String queueName = e.getKey();
      CSQueue oldQueue = e.getValue();
      //new queue里面找不到新的queue
      CSQueue newQueue = newQueues.get(queueName); 
      if (null == newQueue) {
        throw new IOException(queueName + " cannot be found during refresh!");
      } else if (!oldQueue.getQueuePath().equals(newQueue.getQueuePath())) {
        throw new IOException(queueName + " is moved from:"
            + oldQueue.getQueuePath() + " to:" + newQueue.getQueuePath()
            + " after refresh, which is not allowed.");
      }
    }
  }
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:27,代码来源:CapacityScheduler.java


示例8: reinitializeQueues

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
@Lock(CapacityScheduler.class)
private void reinitializeQueues(CapacitySchedulerConfiguration conf) 
throws IOException {
  // Parse new queues
  Map<String, CSQueue> newQueues = new HashMap<String, CSQueue>();
  CSQueue newRoot = 
      parseQueue(this, conf, null, CapacitySchedulerConfiguration.ROOT, 
          newQueues, queues, noop); 
  
  // Ensure all existing queues are still present
  validateExistingQueues(queues, newQueues);

  // Add new queues
  addNewQueues(queues, newQueues);
  
  // Re-configure queues
  root.reinitialize(newRoot, clusterResource);
  initializeQueueMappings();

  // Re-calculate headroom for active applications
  root.updateClusterResource(clusterResource);

  labelManager.reinitializeQueueLabels(getQueueToLabels());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:25,代码来源:CapacityScheduler.java


示例9: getQueueInfo

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
@Override
@Lock(Lock.NoLock.class)
public QueueInfo getQueueInfo(String queueName, 
    boolean includeChildQueues, boolean recursive) 
throws IOException {
  CSQueue queue = null;

  synchronized (this) {
    queue = this.queues.get(queueName); 
  }

  if (queue == null) {
    throw new IOException("Unknown queue: " + queueName);
  }
  return queue.getQueueInfo(includeChildQueues, recursive);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:17,代码来源:CapacityScheduler.java


示例10: activateApplication

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
/**
 * An application has new outstanding requests.
 * 
 * @param user application user 
 * @param applicationId activated application
 */
@Lock({Queue.class, SchedulerApplication.class})
synchronized public void activateApplication(
    String user, ApplicationId applicationId) {
  Set<ApplicationId> userApps = usersApplications.get(user);
  if (userApps == null) {
    userApps = new HashSet<ApplicationId>();
    usersApplications.put(user, userApps);
    ++activeUsers;
    metrics.incrActiveUsers();
    LOG.debug("User " + user + " added to activeUsers, currently: " + 
        activeUsers);
  }
  if (userApps.add(applicationId)) {
    metrics.activateApp(user);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:23,代码来源:ActiveUsersManager.java


示例11: deactivateApplication

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
/**
 * An application has no more outstanding requests.
 * 
 * @param user application user 
 * @param applicationId deactivated application
 */
@Lock({Queue.class, SchedulerApplication.class})
synchronized public void deactivateApplication(
    String user, ApplicationId applicationId) {
  Set<ApplicationId> userApps = usersApplications.get(user);
  if (userApps != null) {
    if (userApps.remove(applicationId)) {
      metrics.deactivateApp(user);
    }
    if (userApps.isEmpty()) {
      usersApplications.remove(user);
      --activeUsers;
      metrics.decrActiveUsers();
      LOG.debug("User " + user + " removed from activeUsers, currently: " + 
          activeUsers);
    }
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:24,代码来源:ActiveUsersManager.java


示例12: reinitializeQueues

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
@Lock(CapacityScheduler.class)
private void reinitializeQueues(CapacitySchedulerConfiguration conf) 
throws IOException {
  // Parse new queues
  Map<String, CSQueue> newQueues = new HashMap<String, CSQueue>();
  CSQueue newRoot = 
      parseQueue(this, conf, null, CapacitySchedulerConfiguration.ROOT, 
          newQueues, queues, noop); 
  
  // Ensure all existing queues are still present
  validateExistingQueues(queues, newQueues);

  // Add new queues
  addNewQueues(queues, newQueues);
  
  // Re-configure queues
  root.reinitialize(newRoot, clusterResource);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:19,代码来源:CapacityScheduler.java


示例13: updateQueueStatistics

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
/**
 * <p>
 * Update Queue Statistics:
 * </p>
 *  
 * <li>used-capacity/absolute-used-capacity by partition</li> 
 * <li>non-partitioned max-avail-resource to queue</li>
 * 
 * <p>
 * When nodePartition is null, all partition of
 * used-capacity/absolute-used-capacity will be updated.
 * </p>
 */
@Lock(CSQueue.class)
public static void updateQueueStatistics(
    final ResourceCalculator rc, final Resource cluster, final Resource minimumAllocation,
    final CSQueue childQueue, final RMNodeLabelsManager nlm, 
    final String nodePartition) {
  QueueCapacities queueCapacities = childQueue.getQueueCapacities();
  ResourceUsage queueResourceUsage = childQueue.getQueueResourceUsage();
  
  if (nodePartition == null) {
    for (String partition : Sets.union(
        queueCapacities.getNodePartitionsSet(),
        queueResourceUsage.getNodePartitionsSet())) {
      updateUsedCapacity(rc, nlm.getResourceByLabel(partition, cluster),
          minimumAllocation, queueResourceUsage, queueCapacities, partition);
    }
  } else {
    updateUsedCapacity(rc, nlm.getResourceByLabel(nodePartition, cluster),
        minimumAllocation, queueResourceUsage, queueCapacities, nodePartition);
  }

  // Update queue metrics w.r.t node labels. In a generic way, we can
  // calculate available resource from all labels in cluster.
  childQueue.getMetrics().setAvailableResourcesToQueue(
      getMaxAvailableResourceToQueue(rc, nlm, childQueue, cluster));
 }
 
开发者ID:hopshadoop,项目名称:hops,代码行数:39,代码来源:CSQueueUtils.java


示例14: initializeQueues

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
@Lock(CapacityScheduler.class)
private void initializeQueues(CapacitySchedulerConfiguration conf)
  throws IOException {

  root = 
      parseQueue(this, conf, null, CapacitySchedulerConfiguration.ROOT, 
          queues, queues, noop);
  labelManager.reinitializeQueueLabels(getQueueToLabels());
  LOG.info("Initialized root queue " + root);
  initializeQueueMappings();
  setQueueAcls(authorizer, queues);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:CapacityScheduler.java


示例15: addNewQueues

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
/**
 * Add the new queues (only) to our list of queues...
 * ... be careful, do not overwrite existing queues.
 * @param queues
 * @param newQueues
 */
@Lock(CapacityScheduler.class)
private void addNewQueues(
    Map<String, CSQueue> queues, Map<String, CSQueue> newQueues) 
{
  for (Map.Entry<String, CSQueue> e : newQueues.entrySet()) {
    String queueName = e.getKey();
    CSQueue queue = e.getValue();
    if (!queues.containsKey(queueName)) {
      queues.put(queueName, queue);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:CapacityScheduler.java


示例16: getQueueInfo

import org.apache.hadoop.yarn.server.utils.Lock; //导入依赖的package包/类
@Override
@Lock(Lock.NoLock.class)
public QueueInfo getQueueInfo(String queueName, 
    boolean includeChildQueues, boolean recursive) 
throws IOException {
  CSQueue queue = null;
  queue = this.queues.get(queueName);
  if (queue == null) {
    throw new IOException("Unknown queue: " + queueName);
  }
  return queue.getQueueInfo(includeChildQueues, recursive);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:CapacityScheduler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RemovalNotification类代码示例发布时间:2022-05-22
下一篇:
Java JobTemplate类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap