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

com.feingto.cloud.dto.tcc.Participant Maven / Gradle / Ivy

There is a newer version: 2.3.5.RELEASE
Show newest version
package com.feingto.cloud.dto.tcc;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.feingto.cloud.kit.DateKit;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.*;

/**
 * 参与者
 *
 * @author longfei
 */
@Data
@Accessors(chain = true)
public class Participant implements Serializable {
    private static final long serialVersionUID = -3971390276878398717L;

    /**
     * 分支事务ID
     */
    private String id;

    /**
     * 请求url
     */
    private String url;

    /**
     * 请求headers头
     */
    private Map headers = new HashMap<>();

    /**
     * 重试次数, 默认3次
     */
    private Integer retry = 3;

    /**
     * 发起时间
     */
    @JsonFormat(pattern = DateKit.DATE_TIME, timezone = "GMT+8")
    private Date createdDate = new Date();

    /**
     * 过期时间
     */
    @JsonFormat(pattern = DateKit.DATE_TIME, timezone = "GMT+8")
    private Date expiredDate;

    /**
     * 事务状态
     */
    private TccStatus status = TccStatus.TRY;

    public Date getExpiredDate() {
        return Objects.nonNull(this.expiredDate) ? this.expiredDate : DateKit.getAfterOf(this.createdDate, 30, Calendar.SECOND);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy