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


Java HealthCheckFailedException类代码示例

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


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

示例1: test

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Test(timeout=60000)
public void test() throws Exception {
  JobTrackerHAServiceProtocol haServiceProtocol =
    cluster.getJobTrackerHaDaemon(0).getJobTrackerHAServiceProtocol();
  
  // Should not throw error, which indicates healthy.
  haServiceProtocol.monitorHealth();
  
  // Forcibly stop JT thread
  haServiceProtocol.getJobTrackerThread().stop();
  haServiceProtocol.getJobTrackerThread().join();
  
  try {
    // Should throw error - JT is unhealthy.
    haServiceProtocol.monitorHealth();
    fail("Should not have succeeded in calling monitorHealth");
  } catch (HealthCheckFailedException hcfe) {
    GenericTestUtils.assertExceptionContains(
        "The JobTracker thread is not running", hcfe);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:23,代码来源:TestJobTrackerHealthCheck.java

示例2: isHealthCheckFailedException

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
private boolean isHealthCheckFailedException(Throwable t) {
  return ((t instanceof HealthCheckFailedException) ||
      (t instanceof RemoteException &&
      ((RemoteException)t).unwrapRemoteException(
          HealthCheckFailedException.class) instanceof
          HealthCheckFailedException));
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:8,代码来源:HealthMonitor.java

示例3: monitorHealth

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
@Override
public synchronized void monitorHealth()
    throws IOException {
  checkAccess("monitorHealth");
  if (isRMActive() && !rm.areActiveServicesRunning()) {
    throw new HealthCheckFailedException(
        "Active ResourceManager services are not running!");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:AdminService.java

示例4: checkMonitorHealth

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
private void checkMonitorHealth() throws IOException {
  try {
    rm.adminService.monitorHealth();
  } catch (HealthCheckFailedException e) {
    fail("The RM is in bad health: it is Active, but the active services " +
        "are not running");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TestRMHA.java

示例5: monitorHealth

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
synchronized void monitorHealth() 
    throws HealthCheckFailedException, AccessControlException {
  namesystem.checkSuperuserPrivilege();
  if (!haEnabled) {
    return; // no-op, if HA is not enabled
  }
  getNamesystem().checkAvailableResources();
  if (!getNamesystem().nameNodeHasResourcesAvailable()) {
    throw new HealthCheckFailedException(
        "The NameNode has no resources available");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:NameNode.java

示例6: doNNHealthCheckTest

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
private void doNNHealthCheckTest() throws IOException {
  NameNodeResourceChecker mockResourceChecker = Mockito.mock(
      NameNodeResourceChecker.class);
  Mockito.doReturn(true).when(mockResourceChecker).hasAvailableDiskSpace();
  cluster.getNameNode(0).getNamesystem()
      .setNNResourceChecker(mockResourceChecker);

  NNHAServiceTarget haTarget = new NNHAServiceTarget(conf,
      DFSUtil.getNamenodeNameServiceId(conf), "nn1");
  HAServiceProtocol rpc = haTarget.getHealthMonitorProxy(conf, conf.getInt(
      HA_HM_RPC_TIMEOUT_KEY, HA_HM_RPC_TIMEOUT_DEFAULT));

  // Should not throw error, which indicates healthy.
  rpc.monitorHealth();

  Mockito.doReturn(false).when(mockResourceChecker).hasAvailableDiskSpace();

  try {
    // Should throw error - NN is unhealthy.
    rpc.monitorHealth();
    fail("Should not have succeeded in calling monitorHealth");
  } catch (HealthCheckFailedException hcfe) {
    GenericTestUtils.assertExceptionContains(
        "The NameNode has no resources available", hcfe);
  } catch (RemoteException re) {
    GenericTestUtils.assertExceptionContains(
        "The NameNode has no resources available",
        re.unwrapRemoteException(HealthCheckFailedException.class));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestNNHealthCheck.java

示例7: testCheckHealth

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
@Test
public void testCheckHealth() throws Exception {
  assertEquals(0, runTool("-checkHealth", "nn1"));
  Mockito.verify(mockProtocol).monitorHealth();
  
  Mockito.doThrow(new HealthCheckFailedException("fake health check failure"))
    .when(mockProtocol).monitorHealth();
  assertEquals(-1, runTool("-checkHealth", "nn1"));
  assertOutputContains("Health check failed: fake health check failure");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:TestDFSHAAdmin.java

示例8: testNNHealthCheck

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
@Test
public void testNNHealthCheck() throws IOException {
  MiniDFSCluster cluster = null;
  try {
    Configuration conf = new Configuration();
    cluster = new MiniDFSCluster.Builder(conf)
        .numDataNodes(0)
        .nnTopology(MiniDFSNNTopology.simpleHATopology())
        .build();

    NameNodeResourceChecker mockResourceChecker = Mockito.mock(
        NameNodeResourceChecker.class);
    Mockito.doReturn(true).when(mockResourceChecker).hasAvailableDiskSpace();
    cluster.getNameNode(0).getNamesystem()
        .setNNResourceChecker(mockResourceChecker);
    
    NamenodeProtocols rpc = cluster.getNameNodeRpc(0);
    
    // Should not throw error, which indicates healthy.
    rpc.monitorHealth();
    
    Mockito.doReturn(false).when(mockResourceChecker).hasAvailableDiskSpace();
    
    try {
      // Should throw error - NN is unhealthy.
      rpc.monitorHealth();
      fail("Should not have succeeded in calling monitorHealth");
    } catch (HealthCheckFailedException hcfe) {
      GenericTestUtils.assertExceptionContains(
          "The NameNode has no resources available", hcfe);
    }
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:38,代码来源:TestNNHealthCheck.java

示例9: doHealthChecks

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
private void doHealthChecks() throws InterruptedException {
  while (shouldRun) {
    HAServiceStatus status = null;
    boolean healthy = false;
    try {
      status = proxy.getServiceStatus();
      proxy.monitorHealth();
      healthy = true;
    } catch (HealthCheckFailedException e) {
      LOG.warn("Service health check failed for " + targetToMonitor
          + ": " + e.getMessage());
      enterState(State.SERVICE_UNHEALTHY);
    } catch (Throwable t) {
      LOG.warn("Transport-level exception trying to monitor health of " +
          targetToMonitor + ": " + t.getLocalizedMessage());
      RPC.stopProxy(proxy);
      proxy = null;
      enterState(State.SERVICE_NOT_RESPONDING);
      Thread.sleep(sleepAfterDisconnectMillis);
      return;
    }
    
    if (status != null) {
      setLastServiceStatus(status);
    }
    if (healthy) {
      enterState(State.SERVICE_HEALTHY);
    }

    Thread.sleep(checkIntervalMillis);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:33,代码来源:HealthMonitor.java

示例10: monitorHealth

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
@Override
public synchronized void monitorHealth()
    throws IOException {
  checkAccess("monitorHealth");
  if (isRMActive() && !rm.areSchedulerServicesRunning()) {
    throw new HealthCheckFailedException(
        "Active ResourceManager services are not running!");
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:10,代码来源:AdminService.java

示例11: monitorHealth

import org.apache.hadoop.ha.HealthCheckFailedException; //导入依赖的package包/类
@Override
public synchronized void monitorHealth() throws IOException {
  checkAccess("monitorHealth");
  if (isRMActive() && !rm.areSchedulerServicesRunning()) {
    throw new HealthCheckFailedException(
        "Active ResourceManager services are not running!");
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:9,代码来源:GroupMembershipService.java


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