支付事务手动提交测试
This commit is contained in:
@@ -7,6 +7,8 @@ import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
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.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -14,6 +16,7 @@ import java.util.function.Consumer;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@Component
|
||||||
public class Utils {
|
public class Utils {
|
||||||
public static int retryCount = 5;
|
public static int retryCount = 5;
|
||||||
private static final Logger log = LoggerFactory.getLogger(Utils.class);
|
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 {
|
public static class ForwardCounter {
|
||||||
private Integer i;
|
private Integer i;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user