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


Java Service.STATE属性代码示例

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


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

示例1: waitForState

public void waitForState(Service.STATE finalState) throws Exception {
  if (finalState == Service.STATE.STOPPED) {
     Assert.assertTrue("Timeout while waiting for MRApp to stop",
         waitForServiceToStop(20 * 1000));
  } else {
    int timeoutSecs = 0;
    while (!finalState.equals(getServiceState()) && timeoutSecs++ < 20) {
      System.out.println("MRApp State is : " + getServiceState()
          + " Waiting for state : " + finalState);
      Thread.sleep(500);
    }
    System.out.println("MRApp State is : " + getServiceState());
    Assert.assertEquals("MRApp state is not correct (timedout)", finalState,
        getServiceState());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:MRApp.java

示例2: toString

@Override
public synchronized String toString() {
  String s =
    name + " - event count = " + eventCount + " last state " + lastState;
  StringBuilder history = new StringBuilder(stateEventList.size()*10);
  for (Service.STATE state: stateEventList) {
    history.append(state).append(" ");
  }
  return s + " [ " + history + "]";
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:10,代码来源:BreakableStateChangeListener.java

示例3: assertStateCount

/**
 * Assert that the breakable service has entered a state exactly the number
 * of time asserted.
 * @param service service -if null an assertion is raised.
 * @param state state to check.
 * @param expected expected count.
 */
public static void assertStateCount(BreakableService service,
                      Service.STATE state,
                      int expected) {
  assertNotNull("Null service", service);
  int actual = service.getCount(state);
  if (expected != actual) {
    fail("Expected entry count for state [" + state +"] of " + service
             + " to be " + expected + " but was " + actual);
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:17,代码来源:ServiceAssert.java

示例4: getLastState

public synchronized Service.STATE getLastState() {
  return lastState;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:3,代码来源:BreakableStateChangeListener.java

示例5: setFailingState

public synchronized void setFailingState(Service.STATE failingState) {
  this.failingState = failingState;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:3,代码来源:BreakableStateChangeListener.java

示例6: getStateEventList

public List<Service.STATE> getStateEventList() {
  return stateEventList;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:3,代码来源:BreakableStateChangeListener.java

示例7: assertServiceInState

public static void assertServiceInState(Service service, Service.STATE state) {
  assertNotNull("Null service", service);
  assertEquals("Service in wrong state: " + service, state,
               service.getServiceState());
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:5,代码来源:ServiceAssert.java

示例8: assertListenerState

/**
 * Assert that the last state of the listener is that the test expected.
 * @param breakable a breakable listener
 * @param state the expected state
 */
public void assertListenerState(BreakableStateChangeListener breakable,
                                Service.STATE state) {
  assertEquals("Wrong state in " + breakable, state, breakable.getLastState());
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:9,代码来源:TestGlobalStateChangeListener.java


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