本文整理汇总了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());
}
}
示例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 + "]";
}
示例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);
}
}
示例4: getLastState
public synchronized Service.STATE getLastState() {
return lastState;
}
示例5: setFailingState
public synchronized void setFailingState(Service.STATE failingState) {
this.failingState = failingState;
}
示例6: getStateEventList
public List<Service.STATE> getStateEventList() {
return stateEventList;
}
示例7: assertServiceInState
public static void assertServiceInState(Service service, Service.STATE state) {
assertNotNull("Null service", service);
assertEquals("Service in wrong state: " + service, state,
service.getServiceState());
}
示例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());
}