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


Java ServiceFailedException类代码示例

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


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

示例1: transitionToStandby

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
@Override
public synchronized void transitionToStandby(
    HAServiceProtocol.StateChangeRequestInfo reqInfo) throws IOException {
  // call refreshAdminAcls before HA state transition
  // for the case that adminAcls have been updated in previous active RM
  try {
    refreshAdminAcls(false);
  } catch (YarnException ex) {
    throw new ServiceFailedException("Can not execute refreshAdminAcls", ex);
  }
  UserGroupInformation user = checkAccess("transitionToStandby");
  checkHaStateChange(reqInfo);
  try {
    rm.transitionToStandby(true);
    RMAuditLogger.logSuccess(user.getShortUserName(),
        "transitionToStandby", "RMHAProtocolService");
  } catch (Exception e) {
    RMAuditLogger.logFailure(user.getShortUserName(), "transitionToStandby",
        "", "RMHAProtocolService",
        "Exception transitioning to standby");
    throw new ServiceFailedException(
        "Error when transitioning to Standby mode", e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:AdminService.java

示例2: refreshAll

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
private void refreshAll() throws ServiceFailedException {
  try {
    refreshQueues(RefreshQueuesRequest.newInstance());
    refreshNodes(RefreshNodesRequest.newInstance());
    refreshSuperUserGroupsConfiguration(
        RefreshSuperUserGroupsConfigurationRequest.newInstance());
    refreshUserToGroupsMappings(
        RefreshUserToGroupsMappingsRequest.newInstance());
    if (getConfig().getBoolean(
        CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
        false)) {
      refreshServiceAcls(RefreshServiceAclsRequest.newInstance());
    }
  } catch (Exception ex) {
    throw new ServiceFailedException(ex.getMessage());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:AdminService.java

示例3: createAdminService

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
@Override
protected AdminService createAdminService() {
  return new AdminService(MockRMWithElector.this, getRMContext()) {
    @Override
    protected EmbeddedElectorService createEmbeddedElectorService() {
      return new EmbeddedElectorService(getRMContext()) {
        @Override
        public void becomeActive() throws
            ServiceFailedException {
          try {
            callbackCalled.set(true);
            LOG.info("Callback called. Sleeping now");
            Thread.sleep(delayMs);
            LOG.info("Sleep done");
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          super.becomeActive();
        }
      };
    }
  };
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestRMEmbeddedElector.java

示例4: cancelAndPreventCheckpoints

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
/**
 * Cancel any checkpoint that's currently being made,
 * and prevent any new checkpoints from starting for the next
 * minute or so.
 */
public void cancelAndPreventCheckpoints(String msg) throws ServiceFailedException {
  synchronized (cancelLock) {
    // The checkpointer thread takes this lock and checks if checkpointing is
    // postponed. 
    thread.preventCheckpointsFor(PREVENT_AFTER_CANCEL_MS);

    // Before beginning a checkpoint, the checkpointer thread
    // takes this lock, and creates a canceler object.
    // If the canceler is non-null, then a checkpoint is in
    // progress and we need to cancel it. If it's null, then
    // the operation has not started, meaning that the above
    // time-based prevention will take effect.
    if (canceler != null) {
      canceler.cancel(msg);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:StandbyCheckpointer.java

示例5: assertCanStartHaNameNodes

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
private void assertCanStartHaNameNodes(String pathSuffix)
    throws ServiceFailedException, IOException, URISyntaxException,
    InterruptedException {
  // Now should be able to start both NNs. Pass "false" here so that we don't
  // try to waitActive on all NNs, since the second NN doesn't exist yet.
  cluster.restartNameNode(0, false);
  cluster.restartNameNode(1, true);
  
  // Make sure HA is working.
  cluster.getNameNode(0).getRpcServer().transitionToActive(
      new StateChangeRequestInfo(RequestSource.REQUEST_BY_USER));
  FileSystem fs = null;
  try {
    Path newPath = new Path(TEST_PATH, pathSuffix);
    fs = HATestUtil.configureFailoverFs(cluster, conf);
    assertTrue(fs.mkdirs(newPath));
    HATestUtil.waitForStandbyToCatchUp(cluster.getNameNode(0),
        cluster.getNameNode(1));
    assertTrue(NameNodeAdapter.getFileInfo(cluster.getNameNode(1),
        newPath.toString(), false).isDir());
  } finally {
    if (fs != null) {
      fs.close();
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestInitializeSharedEdits.java

示例6: refreshAll

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
private void refreshAll() throws ServiceFailedException {
  try {
    refreshQueues(RefreshQueuesRequest.newInstance());
    refreshNodes(RefreshNodesRequest.newInstance(DecommissionType.NORMAL));
    refreshSuperUserGroupsConfiguration(
        RefreshSuperUserGroupsConfigurationRequest.newInstance());
    refreshUserToGroupsMappings(
        RefreshUserToGroupsMappingsRequest.newInstance());
    if (getConfig().getBoolean(
        CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
        false)) {
      refreshServiceAcls(RefreshServiceAclsRequest.newInstance());
    }
    refreshClusterMaxPriority(RefreshClusterMaxPriorityRequest.newInstance());
  } catch (Exception ex) {
    throw new ServiceFailedException(ex.getMessage());
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:AdminService.java

示例7: createAdminService

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
@Override
protected AdminService createAdminService() {
  return new AdminService(MockRMWithElector.this, getRMContext()) {
    @Override
    protected EmbeddedElectorService createEmbeddedElectorService() {
      return new EmbeddedElectorService(getRMContext()) {
        @Override
        public void becomeActive() throws
            ServiceFailedException {
          try {
            callbackCalled.set(true);
            TestRMEmbeddedElector.LOG.info("Callback called. Sleeping now");
            Thread.sleep(delayMs);
            TestRMEmbeddedElector.LOG.info("Sleep done");
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          super.becomeActive();
        }
      };
    }
  };
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestRMEmbeddedElector.java

示例8: getServiceStatus

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
synchronized HAServiceStatus getServiceStatus()
    throws ServiceFailedException, AccessControlException {
  namesystem.checkSuperuserPrivilege();
  if (!haEnabled) {
    throw new ServiceFailedException("HA for namenode is not enabled");
  }
  if (state == null) {
    return new HAServiceStatus(HAServiceState.INITIALIZING);
  }
  HAServiceState retState = state.getServiceState();
  HAServiceStatus ret = new HAServiceStatus(retState);
  if (retState == HAServiceState.STANDBY) {
    if (namesystem.isInSafeMode()) {
      ret.setNotReadyToBecomeActive("The NameNode is in safemode. " +
          namesystem.getSafeModeTip());
    } else {
      ret.setReadyToBecomeActive();
    }
  } else if (retState == HAServiceState.ACTIVE) {
    ret.setReadyToBecomeActive();
  } else {
    ret.setNotReadyToBecomeActive("State is " + state);
  }
  return ret;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:NameNode.java

示例9: stop

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
/**
* Stop all NameNode threads and wait for all to finish.
*/
 public void stop() {
     synchronized (this) {
         if (stopRequested) {
             return;
         }
         stopRequested = true;
     }
     try {
         exitActiveServices();
     } catch (ServiceFailedException e) {
         LOG.warn("Encountered exception while exiting state ", e);
     } finally {
         stopCommonServices();
         if (metrics != null) {
             metrics.shutdown();
         }
         if (namesystem != null) {
             namesystem.shutdown();
         }
     }
 }
 
开发者ID:hopshadoop,项目名称:hops,代码行数:25,代码来源:NameNode.java

示例10: transitionToStandby

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
@Override
public void transitionToStandby(StateChangeRequestInfo reqInfo)
    throws ServiceFailedException, AccessControlException, IOException {
  if (haState == HAServiceState.STANDBY) {
    LOG.info("Already in standby state.");
    return;
  }
  LOG.info("Transitioning to standby");
  try {
    if (sysDirMonitorExecutor != null) {
      sysDirMonitorExecutor.shutdownNow();
    }
    jtRunner.stopJobTracker();
    httpRedirector.start();
  } catch (Throwable t) {
    doImmediateShutdown(t);
  }
  sysDirMonitorExecutor = null;
  currentSysDir = null;
  haState = HAServiceState.STANDBY;
  LOG.info("Transitioned to standby");
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:23,代码来源:JobTrackerHAServiceProtocol.java

示例11: refreshAll

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
private void refreshAll() throws ServiceFailedException {
  try {
    refreshQueues(RefreshQueuesRequest.newInstance());
    refreshNodes(RefreshNodesRequest.newInstance(DecommissionType.NORMAL));
    refreshSuperUserGroupsConfiguration(
        RefreshSuperUserGroupsConfigurationRequest.newInstance());
    refreshUserToGroupsMappings(
        RefreshUserToGroupsMappingsRequest.newInstance());
    if (getConfig().getBoolean(
        CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
        false)) {
      refreshServiceAcls(RefreshServiceAclsRequest.newInstance());
    }
    refreshClusterMaxPriority(RefreshClusterMaxPriorityRequest.newInstance());
  } catch (Exception ex) {
    throw new ServiceFailedException("RefreshAll operation failed", ex);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:19,代码来源:AdminService.java

示例12: createEmbeddedElector

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
@Override
protected EmbeddedElector createEmbeddedElector() {
  return new ActiveStandbyElectorBasedElectorService(getRMContext()) {
    @Override
    public void becomeActive() throws
        ServiceFailedException {
      try {
        callbackCalled.set(true);
        TestRMEmbeddedElector.LOG.info("Callback called. Sleeping now");
        Thread.sleep(delayMs);
        TestRMEmbeddedElector.LOG.info("Sleep done");
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      super.becomeActive();
    }
  };
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:19,代码来源:TestRMEmbeddedElector.java

示例13: transitionToStandby

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
@Override
public synchronized void transitionToStandby(
    HAServiceProtocol.StateChangeRequestInfo reqInfo) throws IOException {
  // call refreshAdminAcls before HA state transition
  // for the case that adminAcls have been updated in previous active RM
  try {
    refreshAdminAcls(false);
  } catch (YarnException ex) {
    throw new ServiceFailedException("Can not execute refreshAdminAcls", ex);
  }
  UserGroupInformation user = checkAccess("transitionToStandby");
  checkHaStateChange(reqInfo);
  try {
    rm.transitionToStandby(true);
    RMAuditLogger.logSuccess(user.getShortUserName(),
        "transitionToStandby", "RM");
  } catch (Exception e) {
    RMAuditLogger.logFailure(user.getShortUserName(), "transitionToStandby",
        "", "RM",
        "Exception transitioning to standby");
    throw new ServiceFailedException(
        "Error when transitioning to Standby mode", e);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:25,代码来源:AdminService.java

示例14: becomeActive

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
@Override
public void becomeActive() throws ServiceFailedException {
  try {
    rmContext.getRMAdminService().transitionToActive(req);
  } catch (Exception e) {
    throw new ServiceFailedException("RM could not transition to Active", e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:EmbeddedElectorService.java

示例15: transitionToActive

import org.apache.hadoop.ha.ServiceFailedException; //导入依赖的package包/类
@Override
public synchronized void transitionToActive(
    HAServiceProtocol.StateChangeRequestInfo reqInfo) throws IOException {
  // call refreshAdminAcls before HA state transition
  // for the case that adminAcls have been updated in previous active RM
  try {
    refreshAdminAcls(false);
  } catch (YarnException ex) {
    throw new ServiceFailedException("Can not execute refreshAdminAcls", ex);
  }

  UserGroupInformation user = checkAccess("transitionToActive");
  checkHaStateChange(reqInfo);
  try {
    rm.transitionToActive();
    // call all refresh*s for active RM to get the updated configurations.
    refreshAll();
    RMAuditLogger.logSuccess(user.getShortUserName(),
        "transitionToActive", "RMHAProtocolService");
  } catch (Exception e) {
    RMAuditLogger.logFailure(user.getShortUserName(), "transitionToActive",
        "", "RMHAProtocolService",
        "Exception transitioning to active");
    throw new ServiceFailedException(
        "Error when transitioning to Active mode", e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:AdminService.java


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