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

com.alibaba.easyretry.common.event.before.BeforeRetryEvent Maven / Gradle / Ivy

The newest version!
package com.alibaba.easyretry.common.event.before;

import java.util.Map;
import java.util.Objects;

import com.alibaba.easyretry.common.entity.RetryTask;
import com.alibaba.easyretry.common.event.RetryEvent;

import com.google.common.collect.Maps;

/**
 * @author Created by wuhao on 2021/3/25.
 */
public abstract class BeforeRetryEvent implements RetryEvent {

	private RetryTask retryTask;

	public BeforeRetryEvent(RetryTask retryTask) {
		this.retryTask = retryTask;
	}

	@Override
	public boolean isOnRetry() {
		return false;
	}

	@Override
	public void setAttribute(String key, String value) {
		Map extAttrs = retryTask.getExtAttrs();
		if (Objects.isNull(extAttrs)) {
			extAttrs = Maps.newHashMap();
		}
		extAttrs.put(key, value);
	}

	@Override
	public String getName() {
		return this.getClass().getSimpleName();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy