In this post under Spring Retry, I will show with example how to configure SimpleRetryPolicy to retry failed operations for specific exceptions and its causes also. They are situations where exceptions are chained together to indicate Exception1 was caused due to Exception2. So here the cause is Exception2 and the main exception is Exception1. So…… Continue reading Spring Retry only for specific exceptions and its causes (using xml)
Author: sumanthprabhakar
Spring Retry only for specific exceptions (using xml configuration)
In this post under Spring Retry, I will show with example how to configure Spring Retry to retry failed operations for specific exceptions only. For this purpose Spring Retry provides out of the box SimpleRetryPolicy class. Below is the xml configuration 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” 4 xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd”>…… Continue reading Spring Retry only for specific exceptions (using xml configuration)
SimpleRetryPolicy used as MaxAttemptsRetryPolicy Example (using xml configuration)
In this post under Spring Retry, I will show with example how to use SimpleRetryPolicy (another implementation of RetryPolicy interface) in place of MaxAttemptsRetryPolicy. SimpleRetryPolicy retries a failed operation for fixed number of times for a set of named exceptions (and subclasses). In this post I will configure SimpleRetryPolicy to retry failed operation for fixed…… Continue reading SimpleRetryPolicy used as MaxAttemptsRetryPolicy Example (using xml configuration)
MaxAttemptsRetryPolicy Example (using xml configuration)
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)
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