支付事务手动提交测试

This commit is contained in:
2024-10-16 17:30:46 +08:00
parent dd43db3341
commit eae849e1e1

View File

@@ -7,6 +7,8 @@ import com.chaozhanggui.system.cashierservice.exception.MsgException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@@ -14,6 +16,7 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
@Component
public class Utils {
public static int retryCount = 5;
private static final Logger log = LoggerFactory.getLogger(Utils.class);
@@ -165,6 +168,11 @@ public class Utils {
}
}
@Transactional
public <R> R runFunAndTransactional(Supplier<R> runnable) {
return runnable.get();
}
public static class ForwardCounter {
private Integer i;