In this post under Spring Retry, I will talk about MaxAttemptsRetryPolicy with example. MaxAttemptsRetryPolicy allows us to configure Spring Retry to retry a failed operation for fixed number of times (including the initial attempt). Below is the xml file showing how to configure MaxAttemptsRetryPolicy XML code 1 <?xml version=”1.0″ encoding=”UTF-8″?> 2 <beans xmlns=”http://www.springframework.org/schema/beans” 3 xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”…… Continue reading MaxAttemptsRetryPolicy Example (using xml configuration)
Author: sumanthprabhakar
TimeoutRetryPolicy Example (using xml configuration)
In this post under Spring Retry, I will show with example the purpose and how to use the TimeoutRetryPolicy. Spring Retry provides RetryPolicy interface and many out of the box implementations of this interface. This interface and its implementations decide whether to retry an operation or not based on given criteria. TimeoutRetryPolicy is one such…… Continue reading TimeoutRetryPolicy Example (using xml configuration)
RecoveryCallback Example (using xml configuration)
In this post under Spring Retry, I will explain with example the purpose of RecoveryCallback. As you know Spring Retry is used for retrying failed operations hoping that during next attempt the operations completes successfuly. But some operations never successfuly completes even after retrying multiple times. So in these cases only option left is recover…… Continue reading RecoveryCallback Example (using xml configuration)
BaseKeyedPooledObjectFactory example
In the previous post under Apache Pool, I showed you with example how to use “KeyedPooledObjectFactory” interface to create an object pool. In this post I will show how to use “BaseKeyedPooledObjectFactory” class provided Apache Pool framework. We created our own implementation of “KeyedPooledObjectFactory” interface in the previous post as shown below. I have added…… Continue reading BaseKeyedPooledObjectFactory example
KeyedPooledObjectFactory Example
In previous post under Apache Pool I showed you how to create a pool of objects. The pool of objects are not classified based on specific criteria. So as a result if you are expecting that Apache Pool should return an object based on specific criteria is not possible. To solve this requirement Apache Pool…… Continue reading KeyedPooledObjectFactory Example
BasePooledObjectFactory class Example
In the previous post under Apache Pool, I showed you with example how to use PooledObjectFactory interface to create an object pool. In this post I will show how to use “BasePooledObjectFactory” class provided Apache Pool framework. We created our own implementation of PooledObjectFactory interface in the previous post as shown below. I have added…… Continue reading BasePooledObjectFactory class Example
Creating Object Pool
In this post under Apache Pool, I will show with simple example how to create a pool of objects. We need the below jar in our classpath to use Apache Pool frameworkcommons-pool2 We need to know about 3 Apache Pool interface1) ObjectPool –> manages pool of objects2) PooledObjectFactory –> takes responsibility of creating and destroying…… Continue reading Creating Object Pool
Adding StatisticsListener (using xml configuration)
In this post under Spring Retry, I will show with example how to add Spring Retry’s StatisticsListener class into your application. StatisticsListener class provided by Spring Retry framework collects statistics of a particular retry operations. The statistics information involves1) Abort Count –> How many times the retry was aborted2) Complete Count –> How many times…… Continue reading Adding StatisticsListener (using xml configuration)
Creating Custom RetryListener (using xml configuration)
In this post under Spring Retry, I will show with example how to add RetryListener to our Spring Retry code. RetryListener interface will help us to react to events like (react before first retry attempt, react after every failed retry attempt, react after final retry attempt). RetryListener interface has the below three interface methods.1) void…… Continue reading Creating Custom RetryListener (using xml configuration)
Spring Retry simple example (using interceptor)
In this post under Spring Retry, I will explain how to configure Spring Retry framework into your application using Spring AOP with simple example. At minimum, you need the below jars in your classpath1) spring-retry-1.3.1.jar2) commons-logging-1.2.jar3) spring-core-4.3.22.RELEASE.jar4) spring-aop-4.3.22.REELEASE.jar5) spring-beans-4.3.22.RELEASE.jar6) spring-context-4.3.22.RELEASE.jar7) spring-expression-4.3.22.RELEASE.jar8) aspectjweaver-1.8.9.jar For our example we will use the below service class Service1 public class…… Continue reading Spring Retry simple example (using interceptor)