本文整理汇总了Java中org.springframework.retry.RetryOperations类的典型用法代码示例。如果您正苦于以下问题:Java RetryOperations类的具体用法?Java RetryOperations怎么用?Java RetryOperations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RetryOperations类属于org.springframework.retry包,在下文中一共展示了RetryOperations类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: tempoApiRetryPolicy
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
@Bean
@Qualifier("tempo")
public RetryOperations tempoApiRetryPolicy() {
final RetryPolicy retryPolicy = createRetryPolicy();
final ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
backOffPolicy.setInitialInterval(2000);
backOffPolicy.setMultiplier(3);
final RetryTemplate retryTemplate = new RetryTemplate();
retryTemplate.setRetryPolicy(retryPolicy);
retryTemplate.setBackOffPolicy(backOffPolicy);
retryTemplate.setThrowLastExceptionOnExhausted(true);
return retryTemplate;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:17,代码来源:TempoApiConfiguration.java
示例2: ReverseProxyFilter
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
public ReverseProxyFilter(
CharonProperties charon,
RetryOperations retryOperations,
RetryOperations defaultRetryOperations,
RequestDataExtractor extractor,
MappingsProvider mappingsProvider,
TaskExecutor taskExecutor,
RequestForwarder requestForwarder,
TraceInterceptor traceInterceptor
) {
this.charon = charon;
this.retryOperations = retryOperations;
this.defaultRetryOperations = defaultRetryOperations;
this.extractor = extractor;
this.mappingsProvider = mappingsProvider;
this.taskExecutor = taskExecutor;
this.requestForwarder = requestForwarder;
this.traceInterceptor = traceInterceptor;
}
开发者ID:mkopylec,项目名称:charon-spring-boot-starter,代码行数:20,代码来源:ReverseProxyFilter.java
示例3: RedisFieldValueCounterRepository
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
public RedisFieldValueCounterRepository(RedisConnectionFactory connectionFactory, String metricPrefix,
RetryOperations retryOperations) {
Assert.notNull(connectionFactory);
Assert.hasText(metricPrefix, "metric prefix cannot be empty");
this.metricPrefix = metricPrefix;
redisTemplate = new StringRedisRetryTemplate(connectionFactory, retryOperations);
// avoids proxy
redisTemplate.setExposeConnection(true);
redisTemplate.afterPropertiesSet();
}
开发者ID:spring-projects,项目名称:spring-analytics,代码行数:11,代码来源:RedisFieldValueCounterRepository.java
示例4: RedisAggregateCounterRepository
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
public RedisAggregateCounterRepository(RedisConnectionFactory redisConnectionFactory, RetryOperations retryOperations) {
redisTemplate = new RedisRetryTemplate<String, String>();
redisTemplate.setConnectionFactory(redisConnectionFactory);
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setValueSerializer(new StringRedisSerializer());
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setHashValueSerializer(new GenericToStringSerializer<Long>(Long.class));
redisTemplate.setRetryOperations(retryOperations);
redisTemplate.afterPropertiesSet();
hashOperations = redisTemplate.opsForHash();
setOperations = redisTemplate.opsForSet();
}
开发者ID:spring-projects,项目名称:spring-analytics,代码行数:13,代码来源:RedisAggregateCounterRepository.java
示例5: StringRedisRetryTemplate
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
/**
* Constructs a new <code>StringRedisTemplate</code> instance with a set of retry operations.
*
* {@link #afterPropertiesSet()} still need to be called if creating outside a spring managed context
* @param connectionFactory connection factory for creating new connections
* @param retryOperations retryOperations instance
*/
public StringRedisRetryTemplate(RedisConnectionFactory connectionFactory, RetryOperations retryOperations) {
RedisSerializer<String> stringSerializer = new StringRedisSerializer();
setKeySerializer(stringSerializer);
setValueSerializer(stringSerializer);
setHashKeySerializer(stringSerializer);
setHashValueSerializer(stringSerializer);
setRetryOperations(retryOperations);
setConnectionFactory(connectionFactory);
afterPropertiesSet();
}
开发者ID:spring-projects,项目名称:spring-analytics,代码行数:18,代码来源:StringRedisRetryTemplate.java
示例6: charonReverseProxyFilter
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public ReverseProxyFilter charonReverseProxyFilter(
@Qualifier("charonRetryOperations") RetryOperations retryOperations,
@Qualifier("charonDefaultRetryOperations") RetryOperations defaultRetryOperations,
RequestDataExtractor extractor,
MappingsProvider mappingsProvider,
@Qualifier("charonTaskExecutor") TaskExecutor taskExecutor,
RequestForwarder requestForwarder,
TraceInterceptor traceInterceptor
) {
return new ReverseProxyFilter(charon, retryOperations, defaultRetryOperations, extractor, mappingsProvider, taskExecutor, requestForwarder, traceInterceptor);
}
开发者ID:mkopylec,项目名称:charon-spring-boot-starter,代码行数:14,代码来源:CharonConfiguration.java
示例7: retryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
@Bean
public RetryOperations retryOperations() {
RetryTemplate retryTemplate = new RetryTemplate();
retryTemplate.setRetryPolicy(new SimpleRetryPolicy(3, Collections.<Class<? extends Throwable>, Boolean>singletonMap(RedisConnectionFailureException.class, true)));
ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
backOffPolicy.setInitialInterval(1000L);
backOffPolicy.setMaxInterval(1000L);
backOffPolicy.setMultiplier(2);
retryTemplate.setBackOffPolicy(backOffPolicy);
return retryTemplate;
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:12,代码来源:FieldValueCounterSinkStoreConfiguration.java
示例8: retryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
@Bean
public RetryOperations retryOperations() {
RetryTemplate retryTemplate = new RetryTemplate();
retryTemplate.setRetryPolicy(new SimpleRetryPolicy(3,
Collections.<Class<? extends Throwable>, Boolean>singletonMap(RedisConnectionFailureException.class, true)));
ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy();
backOffPolicy.setInitialInterval(1000L);
backOffPolicy.setMaxInterval(1000L);
backOffPolicy.setMultiplier(2);
retryTemplate.setBackOffPolicy(backOffPolicy);
return retryTemplate;
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:13,代码来源:AggregateCounterSinkStoreConfiguration.java
示例9: retryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
/**
* リトライのポリシー(間隔、回数)を設定し、
* {@link RetryOperations}のインスタンスをDIコンテナに登録します。
* @return {@link RetryTemplate}のインスタンス
*/
@Bean
public RetryOperations retryOperations() {
RetryTemplate template = new RetryTemplate();
template.setRetryPolicy(retryPolicy());
template.setBackOffPolicy(backOffPolicy());
return template;
}
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:13,代码来源:ExceptionQueueContextConfig.java
示例10: setMetadataRetryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
/**
* @param metadataRetryOperations the retry configuration
*/
public void setMetadataRetryOperations(RetryOperations metadataRetryOperations) {
this.metadataRetryOperations = metadataRetryOperations;
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-kafka,代码行数:7,代码来源:KafkaTopicProvisioner.java
示例11: RetryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
public RetryOperations RetryOperations() {
return retryOperations;
}
开发者ID:spring-projects,项目名称:spring-analytics,代码行数:4,代码来源:RedisRetryTemplate.java
示例12: setRetryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
public void setRetryOperations(RetryOperations retryOperations) {
this.retryOperations = retryOperations;
}
开发者ID:spring-projects,项目名称:spring-analytics,代码行数:4,代码来源:RedisRetryTemplate.java
示例13: createRetryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
protected RetryOperations createRetryOperations(RetryListener listener, int maxAttempts, List<Class<? extends Throwable>> retryableErrors) {
Map<Class<? extends Throwable>, Boolean> retryableExceptions = new HashMap<>(retryableErrors.size());
retryableErrors.forEach(error -> retryableExceptions.put(error, true));
SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy(maxAttempts, retryableExceptions);
RetryTemplate retryTemplate = new RetryTemplate();
retryTemplate.setRetryPolicy(retryPolicy);
retryTemplate.registerListener(listener);
return retryTemplate;
}
开发者ID:mkopylec,项目名称:charon-spring-boot-starter,代码行数:10,代码来源:CharonConfiguration.java
示例14: resolveRetryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
protected RetryOperations resolveRetryOperations(MappingProperties mapping) {
return mapping != null && mapping.isRetryable() ? retryOperations : defaultRetryOperations;
}
开发者ID:mkopylec,项目名称:charon-spring-boot-starter,代码行数:4,代码来源:ReverseProxyFilter.java
示例15: assertThat
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
@Test
public void デフォルト値が設定されて指定のインスタンスがDIコンテナに登録される() {
assertThat(config.errorExchangeKey, is("error.exchange"));
assertThat(config.exceptionBindingKey, is("#.exception.#"));
assertThat(config.exceptionExchangeKey, is("exception.exchange"));
assertThat(config.recoverableExceptionQueue, is("recoverable.exception.messages.queue"));
assertThat(config.unrecoverableExceptionQueue, is("unrecoverable.exception.messages.queue"));
assertThat(config.unrecoverableExceptionBindingKey, is("#.unrecoverable.exception.#"));
assertThat(config.recoverableExceptionBindingKey, is("#.recoverable.exception.#"));
assertThat(config.unknownExceptionRoutingKey, is("unknown.unrecoverable.exception.key"));
TopicExchange error = context.getBean("errorExchange", TopicExchange.class);
assertThat(error, is(notNullValue()));
assertThat(error.getType(), is("topic"));
assertThat(error.getName(), is("error.exchange"));
TopicExchange exception = context.getBean("exceptionExchange", TopicExchange.class);
assertThat(exception, is(notNullValue()));
assertThat(exception.getType(), is("topic"));
assertThat(exception.getName(), is("exception.exchange"));
Queue recover = context.getBean("recoverableExceptionQueue", Queue.class);
assertThat(recover, is(notNullValue()));
assertThat(recover.getName(), is("recoverable.exception.messages.queue"));
Queue unrecover = context.getBean("unrecoverableExceptionQueue", Queue.class);
assertThat(unrecover, is(notNullValue()));
assertThat(unrecover.getName(), is("unrecoverable.exception.messages.queue"));
Binding exceptionBinding = context.getBean("exceptionBinding", Binding.class);
assertThat(exceptionBinding, is(notNullValue()));
assertThat(exceptionBinding.getExchange(), is("error.exchange"));
assertThat(exceptionBinding.getDestination(), is("exception.exchange"));
assertThat(exceptionBinding.getRoutingKey(), is("#.exception.#"));
Binding recoverBinding = context.getBean("recoverableExceptionQueueBinding", Binding.class);
assertThat(recoverBinding, is(notNullValue()));
assertThat(recoverBinding.getExchange(), is("exception.exchange"));
assertThat(recoverBinding.getDestination(), is("recoverable.exception.messages.queue"));
assertThat(recoverBinding.getRoutingKey(), is("#.recoverable.exception.#"));
Binding unrecoverBinding = context.getBean("unrecoverableExceptionQueueBinding", Binding.class);
assertThat(unrecoverBinding, is(notNullValue()));
assertThat(unrecoverBinding.getExchange(), is("exception.exchange"));
assertThat(unrecoverBinding.getDestination(), is("unrecoverable.exception.messages.queue"));
assertThat(unrecoverBinding.getRoutingKey(), is("#.unrecoverable.exception.#"));
assertThat(config.retryCount, is(10));
assertThat(config.backOffPeriod, is(1000L));
assertThat(context.getBean(RetryOperations.class), is(notNullValue()));
assertThat(context.getBean(ExceptionMessageExchanger.class), is(notNullValue()));
assertThat(context.getBean(LoggingErrorHandler.class), is(notNullValue()));
LoggingErrorHandler handler = context.getBean(LoggingErrorHandler.class);
BinaryExceptionClassifier mapping = handler.getRetryableClassifier();
assertThat(mapping, is(notNullValue()));
assertThat(mapping.classify(new AmqpApplicationRecoverableException("")), is(true));
assertThat(mapping.classify(new AmqpApplicationUnrecoverableException("")), is(false));
assertThat(context.getBean(LoggingErrorHandler.class), is(notNullValue()));
assertThat(context.getBean(Advice[].class), is(notNullValue()));
assertThat(context.getBean(StatefulRetryOperationsInterceptor.class), is(notNullValue()));
}
开发者ID:ctc-g,项目名称:sinavi-jfw,代码行数:55,代码来源:ExceptionQueueContextConfigTest.java
示例16: charonRetryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(name = "charonRetryOperations")
public RetryOperations charonRetryOperations(@Qualifier("charonRetryListener") RetryListener listener) {
return createRetryOperations(listener, charon.getRetrying().getMaxAttempts(), charon.getRetrying().getRetryOn().getExceptions());
}
开发者ID:mkopylec,项目名称:charon-spring-boot-starter,代码行数:6,代码来源:CharonConfiguration.java
示例17: charonDefaultRetryOperations
import org.springframework.retry.RetryOperations; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(name = "charonDefaultRetryOperations")
public RetryOperations charonDefaultRetryOperations(@Qualifier("charonRetryListener") RetryListener listener) {
return createRetryOperations(listener, 1, emptyList());
}
开发者ID:mkopylec,项目名称:charon-spring-boot-starter,代码行数:6,代码来源:CharonConfiguration.java
注:本文中的org.springframework.retry.RetryOperations类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论