本文整理匯總了Java中org.springframework.http.client.SimpleClientHttpRequestFactory.setTaskExecutor方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleClientHttpRequestFactory.setTaskExecutor方法的具體用法?Java SimpleClientHttpRequestFactory.setTaskExecutor怎麽用?Java SimpleClientHttpRequestFactory.setTaskExecutor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.http.client.SimpleClientHttpRequestFactory
的用法示例。
在下文中一共展示了SimpleClientHttpRequestFactory.setTaskExecutor方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: AsyncRestTemplate
import org.springframework.http.client.SimpleClientHttpRequestFactory; //導入方法依賴的package包/類
/**
* Create a new instance of the {@code AsyncRestTemplate} using the given
* {@link AsyncTaskExecutor}.
* <p>This constructor uses a {@link SimpleClientHttpRequestFactory} in combination
* with the given {@code AsyncTaskExecutor} for asynchronous execution.
*/
public AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor) {
Assert.notNull(taskExecutor, "AsyncTaskExecutor must not be null");
SimpleClientHttpRequestFactory requestFactory =
new SimpleClientHttpRequestFactory();
requestFactory.setTaskExecutor(taskExecutor);
this.syncTemplate = new RestTemplate(requestFactory);
setAsyncRequestFactory(requestFactory);
}
示例2: AsyncRestTemplate
import org.springframework.http.client.SimpleClientHttpRequestFactory; //導入方法依賴的package包/類
/**
* Create a new instance of the {@code AsyncRestTemplate} using the given
* {@link AsyncTaskExecutor}.
* <p>This constructor uses a {@link SimpleClientHttpRequestFactory} in combination
* with the given {@code AsyncTaskExecutor} for asynchronous execution.
*/
public AsyncRestTemplate(AsyncListenableTaskExecutor taskExecutor) {
Assert.notNull(taskExecutor, "AsyncTaskExecutor must not be null");
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setTaskExecutor(taskExecutor);
this.syncTemplate = new RestTemplate(requestFactory);
setAsyncRequestFactory(requestFactory);
}
示例3: simpleRequestFactory
import org.springframework.http.client.SimpleClientHttpRequestFactory; //導入方法依賴的package包/類
static HttpConfigurer simpleRequestFactory(final ExecutorService executor) {
return builder -> {
final SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setTaskExecutor(new ConcurrentTaskExecutor(executor));
builder.requestFactory(factory);
};
}
示例4: getAsyncRestTemplate
import org.springframework.http.client.SimpleClientHttpRequestFactory; //導入方法依賴的package包/類
private AsyncRestTemplate getAsyncRestTemplate() {
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
factory.setTaskExecutor(new SimpleAsyncTaskExecutor());
factory.setConnectTimeout(gorouterProperties.getConnectTimeout());
factory.setReadTimeout(gorouterProperties.getReadTimeout());
return new AsyncRestTemplate(factory);
}
示例5: defaultClientHttpRequestFactory
import org.springframework.http.client.SimpleClientHttpRequestFactory; //導入方法依賴的package包/類
private SimpleClientHttpRequestFactory defaultClientHttpRequestFactory(Tracer tracer) {
SimpleClientHttpRequestFactory simpleClientHttpRequestFactory = new SimpleClientHttpRequestFactory();
simpleClientHttpRequestFactory.setTaskExecutor(asyncListenableTaskExecutor(tracer));
return simpleClientHttpRequestFactory;
}
示例6: defaultClientHttpRequestFactory
import org.springframework.http.client.SimpleClientHttpRequestFactory; //導入方法依賴的package包/類
private SimpleClientHttpRequestFactory defaultClientHttpRequestFactory() {
SimpleClientHttpRequestFactory simpleClientHttpRequestFactory = new SimpleClientHttpRequestFactory();
simpleClientHttpRequestFactory.setTaskExecutor(asyncListenableTaskExecutor(this.tracer));
return simpleClientHttpRequestFactory;
}
示例7: asyncRestTemplate
import org.springframework.http.client.SimpleClientHttpRequestFactory; //導入方法依賴的package包/類
@Bean
AsyncRestTemplate asyncRestTemplate(@LoadBalanced RestTemplate restTemplate) {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setTaskExecutor(threadPoolTaskScheduler());
return new AsyncRestTemplate(requestFactory, restTemplate);
}