Dstu2 fhir 设置HAPI FHIR IGenericClient的超时

Dstu2 fhir 设置HAPI FHIR IGenericClient的超时,dstu2-fhir,hl7-fhir,hapi-fhir,Dstu2 Fhir,Hl7 Fhir,Hapi Fhir,我正在尝试使用以下代码运行fhir搜索 FhirContext ctx = FhirContext.forDstu2(); ctx.getRestfulClientFactory().setConnectTimeout(2000000); IGenericClient client = ctx.newRestfulGenericClient("http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2"); Bundle result

我正在尝试使用以下代码运行fhir搜索

FhirContext ctx = FhirContext.forDstu2();
ctx.getRestfulClientFactory().setConnectTimeout(2000000);
IGenericClient client = ctx.newRestfulGenericClient("http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2");

Bundle results = client.search().forResource(Basic.class).returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class).execute();
但是,当它运行时,总是抛出异常“FhirClientConnectionException”,这是由异常“SocketTimeoutException”引起的。我是否要假设这是服务器超时,而不是我的本地连接,因为我将本地设置为2000000

我该如何着手修理?我在它的开箱即用配置中使用了HAPI,它会在大约10-15秒内超时搜索相对较少的资源。

请尝试
setSocketTimeout()

像这样:

FhirContext ctx=FhirContext.forDstu2();
ctx.getRestfulClientFactory().setSocketTimeout(200*1000);
IGenericClient=ctx.newRestfulGenericClient(“http://localhost:1080/hapi-fhir jpaserver示例/baseDstu2”);
Bundle results=client.search().forResource(Basic.class).returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class).execute();
v3示例:

serverBase=”http://hapi.fhir.org/baseDstu3";
ctx=FhirContext.forDstu3();
ctx.getRestfulClientFactory().setSocketTimeout(200*1000);
//创建客户端
client=ctx.newRestfulGenericClient(serverBase);
我在这里找到了阅读源代码的答案: