Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2006-2007 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.springframework.batch.retry.support;
 

Author(s):
Dave Syer
 
 public class DefaultRetryState implements RetryState {
 
 	final private Object key;
 
 	final private boolean forceRefresh;
 
 	final private Classifier<? super ThrowableBooleanrollbackClassifier;

Create a DefaultRetryState representing the state for a new retry attempt.

Parameters:
key the key for the state to allow this retry attempt to be recognised
forceRefresh true if the attempt is known to be a brand new state (could not have previously failed)
rollbackClassifier the rollback classifier to set. The rollback classifier answers true if the exception provided should cause a rollback.
See also:
org.springframework.batch.retry.RetryOperations.execute(org.springframework.batch.retry.RetryCallback,org.springframework.batch.retry.RetryState)
org.springframework.batch.retry.RetryOperations.execute(org.springframework.batch.retry.RetryCallback,org.springframework.batch.retry.RecoveryCallback,org.springframework.batch.retry.RetryState)
 
 	public DefaultRetryState(Object keyboolean forceRefreshClassifier<? super ThrowableBooleanrollbackClassifier) {
 		this. = key;
 		this. = forceRefresh;
 		this. = rollbackClassifier;
 	}

Defaults the force refresh flag to false.

 
 	public DefaultRetryState(Object keyClassifier<? super ThrowableBooleanrollbackClassifier) {
 		this(keyfalserollbackClassifier);
 	}

Defaults the rollback classifier to null.

 
 	public DefaultRetryState(Object keyboolean forceRefresh) {
 		this(keyforceRefreshnull);
 	}

Defaults the force refresh flag (to false) and the rollback classifier (to null).

 
 	public DefaultRetryState(Object key) {
 		this(keyfalsenull);
 	}
 
 	/*
 	 * (non-Javadoc)
 	 * 
 	 * @see org.springframework.batch.retry.IRetryState#getKey()
 	 */
 	public Object getKey() {
 		return ;
 	}
 
 	/*
 	 * (non-Javadoc)
 	 * 
 	 * @see org.springframework.batch.retry.IRetryState#isForceRefresh()
 	 */
 	public boolean isForceRefresh() {
 		return ;
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.springframework.batch.retry.RetryState#rollbackFor(java.lang.Throwable
	 * )
	 */
	public boolean rollbackFor(Throwable exception) {
		if ( == null) {
			return true;
		}
		return .classify(exception);
	}
	public String toString() {
		return String.format("[%s: key=%s, forceRefresh=%b]"getClass().getSimpleName(), );
	}
New to GrepCode? Check out our FAQ X