All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.bitsensor.plugins.shaded.org.springframework.retry.stats.DefaultRetryStatistics Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2012-2015 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 io.bitsensor.plugins.shaded.org.springframework.retry.stats;

import java.util.concurrent.atomic.AtomicInteger;

import io.bitsensor.plugins.shaded.org.springframework.core.AttributeAccessorSupport;
import io.bitsensor.plugins.shaded.org.springframework.retry.RetryStatistics;

/**
 * @author Dave Syer
 *
 */
@SuppressWarnings("serial")
public class DefaultRetryStatistics extends AttributeAccessorSupport implements RetryStatistics, MutableRetryStatistics {

	private String name;
	private AtomicInteger startedCount = new AtomicInteger();
	private AtomicInteger completeCount = new AtomicInteger();
	private AtomicInteger recoveryCount = new AtomicInteger();
	private AtomicInteger errorCount = new AtomicInteger();
	private AtomicInteger abortCount = new AtomicInteger();

	DefaultRetryStatistics() {
	}

	public DefaultRetryStatistics(String name) {
		this.name = name;
	}

	@Override
	public int getCompleteCount() {
		return completeCount.get();
	}

	@Override
	public int getStartedCount() {
		return startedCount.get();
	}

	@Override
	public int getErrorCount() {
		return errorCount.get();
	}

	@Override
	public int getAbortCount() {
		return abortCount.get();
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public int getRecoveryCount() {
		return recoveryCount.get();
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public void incrementStartedCount() {
		this.startedCount.incrementAndGet();
	}

	@Override
	public void incrementCompleteCount() {
		this.completeCount.incrementAndGet();
	}

	@Override
	public void incrementRecoveryCount() {
		this.recoveryCount.incrementAndGet();
	}

	@Override
	public void incrementErrorCount() {
		this.errorCount.incrementAndGet();
	}

	@Override
	public void incrementAbortCount() {
		this.abortCount.incrementAndGet();
	}

	@Override
	public String toString() {
		return "DefaultRetryStatistics [name=" + name + ", startedCount=" + startedCount
				+ ", completeCount=" + completeCount + ", recoveryCount=" + recoveryCount
				+ ", errorCount=" + errorCount + ", abortCount=" + abortCount + "]";
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy