本文整理汇总了Java中org.hawk.core.IStateListener.HawkState方法的典型用法代码示例。如果您正苦于以下问题:Java IStateListener.HawkState方法的具体用法?Java IStateListener.HawkState怎么用?Java IStateListener.HawkState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hawk.core.IStateListener
的用法示例。
在下文中一共展示了IStateListener.HawkState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitFor
import org.hawk.core.IStateListener; //导入方法依赖的package包/类
@Override
public void waitFor(IStateListener.HawkState targetState, long timeoutMillis) throws InterruptedException {
synchronized (stateListener) {
final long end = System.currentTimeMillis() + timeoutMillis;
for (IStateListener.HawkState s = stateListener.getCurrentState(); s != targetState; s = stateListener.getCurrentState()) {
if (s == IStateListener.HawkState.STOPPED) {
throw new IllegalStateException("The selected Hawk is stopped");
}
if (timeoutMillis == 0) {
stateListener.wait();
} else {
final long remaining = end - System.currentTimeMillis();
if (remaining > 0) {
// Wait for the remaining time
stateListener.wait(remaining);
} else {
// Exit the loop due to timeout
break;
}
}
}
}
}
示例2: listInstances
import org.hawk.core.IStateListener; //导入方法依赖的package包/类
@Override
public InstanceInfo[] listInstances(String location) throws Exception {
final Hawk.Client client = getClient(location);
final List<HawkInstance> instances = client.listInstances();
final InstanceInfo[] infos = new InstanceInfo[instances.size()];
for (int iInfo = 0; iInfo < instances.size(); ++iInfo) {
HawkInstance instance = instances.get(iInfo);
IStateListener.HawkState hawkState = HawkState.STOPPED;
switch (instance.state) {
case RUNNING:
hawkState = HawkState.RUNNING;
break;
case STOPPED:
hawkState = HawkState.STOPPED;
break;
case UPDATING:
hawkState = HawkState.UPDATING;
break;
}
infos[iInfo] = new InstanceInfo(instance.name, null, hawkState);
}
return infos;
}
示例3: mapHawkStateToThrift
import org.hawk.core.IStateListener; //导入方法依赖的package包/类
public static uk.ac.york.mondo.integration.api.HawkState mapHawkStateToThrift(IStateListener.HawkState state) {
switch (state) {
case RUNNING: return uk.ac.york.mondo.integration.api.HawkState.RUNNING;
case UPDATING: return uk.ac.york.mondo.integration.api.HawkState.UPDATING;
default: return uk.ac.york.mondo.integration.api.HawkState.STOPPED;
}
}
示例4: mapThriftStateToHawk
import org.hawk.core.IStateListener; //导入方法依赖的package包/类
public static IStateListener.HawkState mapThriftStateToHawk(uk.ac.york.mondo.integration.api.HawkState state) {
switch (state) {
case RUNNING: return IStateListener.HawkState.RUNNING;
case UPDATING: return IStateListener.HawkState.UPDATING;
default: return IStateListener.HawkState.STOPPED;
}
}
示例5: mapHawkStateToThrift
import org.hawk.core.IStateListener; //导入方法依赖的package包/类
public static org.hawk.service.api.HawkState mapHawkStateToThrift(IStateListener.HawkState state) {
switch (state) {
case RUNNING: return org.hawk.service.api.HawkState.RUNNING;
case UPDATING: return org.hawk.service.api.HawkState.UPDATING;
default: return org.hawk.service.api.HawkState.STOPPED;
}
}
示例6: mapThriftStateToHawk
import org.hawk.core.IStateListener; //导入方法依赖的package包/类
public static IStateListener.HawkState mapThriftStateToHawk(org.hawk.service.api.HawkState state) {
switch (state) {
case RUNNING: return IStateListener.HawkState.RUNNING;
case UPDATING: return IStateListener.HawkState.UPDATING;
default: return IStateListener.HawkState.STOPPED;
}
}