本文整理汇总了Java中org.hawk.core.IStateListener类的典型用法代码示例。如果您正苦于以下问题:Java IStateListener类的具体用法?Java IStateListener怎么用?Java IStateListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IStateListener类属于org.hawk.core包,在下文中一共展示了IStateListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: fireState
import org.hawk.core.IStateListener; //导入依赖的package包/类
protected void fireState() {
switch (currentState) {
case RUNNING:
stateListener.state(IStateListener.HawkState.RUNNING);
break;
case STOPPED:
stateListener.state(IStateListener.HawkState.STOPPED);
break;
case UPDATING:
stateListener.state(IStateListener.HawkState.UPDATING);
break;
}
}
示例6: 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;
}
}
示例7: 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;
}
}
示例8: remove
import org.hawk.core.IStateListener; //导入依赖的package包/类
@Override
public boolean remove(Object e) {
final boolean ret = super.remove(e);
if (ret) {
((IStateListener) e).removed();
}
return ret;
}
示例9: info
import org.hawk.core.IStateListener; //导入依赖的package包/类
@Override
public void info(String s) {
for (IStateListener l : this) {
l.info(s);
}
LOGGER.info(s);
}
示例10: error
import org.hawk.core.IStateListener; //导入依赖的package包/类
@Override
public void error(String s) {
for (IStateListener l : this) {
l.error(s);
}
LOGGER.error(s);
}
示例11: addStateListener
import org.hawk.core.IStateListener; //导入依赖的package包/类
@Override
public boolean addStateListener(IStateListener l) {
return stateListener.add(l);
}
示例12: removeStateListener
import org.hawk.core.IStateListener; //导入依赖的package包/类
@Override
public boolean removeStateListener(IStateListener l) {
return stateListener.remove(l);
}
示例13: add
import org.hawk.core.IStateListener; //导入依赖的package包/类
@Override
public boolean add(IStateListener e) {
final boolean ret = super.add(e);
e.state(currentState);
return ret;
}
示例14: addStateListener
import org.hawk.core.IStateListener; //导入依赖的package包/类
@Override
public boolean addStateListener(IStateListener listener) {
final boolean ret = stateListener.add(listener);
return ret;
}
示例15: removeStateListener
import org.hawk.core.IStateListener; //导入依赖的package包/类
@Override
public boolean removeStateListener(IStateListener listener) {
return stateListener.remove(listener);
}