我正在写一个应用程序,我想实现断路器模式.这是我写的Hystrix Command类:
public class HystrixCommandNextGen extends HystrixCommand<ScriptContext> {
private ScriptContext scriptctx;
private ScriptFactory scriptFactory;
private ScriptContext responseContext = null;
private Logger logger = LoggerFactory.getLogger(HystrixCommandNextGen.class);
public HystrixCommandNextGen(ScriptContext scriptctx, ScriptFactory scriptFactory) {
super(
Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("Thread_Pool"))
.andCommandKey(HystrixCommandKey.Factory.asKey(scriptctx.getExecutionData(ExecutionParam.SCRIPTNAME)))
);
this.scriptctx = scriptctx;
this.scriptFactory = scriptFactory;
HystrixCommandProperties.Setter().withCircuitBreakerEnabled(true);
HystrixCommandProperties.Setter().withCircuitBreakerRequestVolumeThreshold(150);
}
@Override
protected ScriptContext run() throws Exception {
scriptFactory.execute(scriptctx);
return scriptctx;
}
@Override
protected ScriptContext getFallback() {
logger.error("FI is not responding: Error occurred in the execution of " + getClass().getSimpleName());
return scriptctx;
}
}
Run Code Online (Sandbox Code Playgroud)
我无法理解如何配置线程数,断路器的阈值时间和要处理的请求数.
我有一个文件描述符列表,我想找到所有可以阅读的内容。到目前为止,我正在使用下面的函数来做 python
select.select(read_fds, [], [], 1),它返回准备读取流的列表。我正在尝试在 Rust 中做同样的事情。我正在使用 nix crate,但是函数select 只返回准备读取的文件描述符的数量。有没有办法获取文件描述符列表?
我想在我的项目中使用openMP库,但似乎在xcode 5.1中没有openMP选项.如果有人知道那么请帮助我