Merge branch 'master' of github.com:jamesagnew/hapi-fhir
This commit is contained in:
commit
cf4b612ae6
|
@ -0,0 +1,65 @@
|
|||
package ca.uhn.fhirtest;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
||||
public class FhirContextFactory implements FactoryBean<FhirContext>, InitializingBean {
|
||||
|
||||
private int myConnectionRequestTimeout = 5000;
|
||||
private int mySocketTimeout = 10000;
|
||||
private int myConnectTimeout = 4000;
|
||||
public int getConnectionRequestTimeout() {
|
||||
return myConnectionRequestTimeout;
|
||||
}
|
||||
|
||||
public void setConnectionRequestTimeout(int theConnectionRequestTimeout) {
|
||||
myConnectionRequestTimeout = theConnectionRequestTimeout;
|
||||
}
|
||||
|
||||
public int getSocketTimeout() {
|
||||
return mySocketTimeout;
|
||||
}
|
||||
|
||||
public void setSocketTimeout(int theSocketTimeout) {
|
||||
mySocketTimeout = theSocketTimeout;
|
||||
}
|
||||
|
||||
public int getConnectTimeout() {
|
||||
return myConnectTimeout;
|
||||
}
|
||||
|
||||
public void setConnectTimeout(int theConnectTimeout) {
|
||||
myConnectTimeout = theConnectTimeout;
|
||||
}
|
||||
|
||||
private FhirContext myCtx;
|
||||
|
||||
public FhirContextFactory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FhirContext getObject() throws Exception {
|
||||
return myCtx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<FhirContext> getObjectType() {
|
||||
return FhirContext.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
myCtx=new FhirContext();
|
||||
myCtx.getRestfulClientFactory().setConnectTimeout(myConnectTimeout);
|
||||
myCtx.getRestfulClientFactory().setSocketTimeout(mySocketTimeout);
|
||||
myCtx.getRestfulClientFactory().setConnectionRequestTimeout(myConnectionRequestTimeout);
|
||||
}
|
||||
|
||||
}
|
|
@ -20,12 +20,7 @@
|
|||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="fhirContext" class="ca.uhn.fhir.context.FhirContext">
|
||||
<property name="restfulClientFactory" ref="restfulClientFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="restfulClientFactory" class="ca.uhn.fhir.rest.client.RestfulClientFactory">
|
||||
<property name="fhirContext" ref="fhirContext"/>
|
||||
<bean id="fhirContext" class="ca.uhn.fhirtest.FhirContextFactory">
|
||||
<property name="connectTimeout" value="4000"/>
|
||||
<property name="socketTimeout" value="10000"/>
|
||||
</bean>
|
||||
|
|
Loading…
Reference in New Issue