io.github.spitmaster.warlock.handler.IgnoreTimeoutHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of warlock-spring-boot-starter Show documentation
Show all versions of warlock-spring-boot-starter Show documentation
warlock-spring-boot-starter is an annotation-driven concurrency tools library for java with Spring.
It is easy to use in Spring application
Just using annotation on your method , the concurrency lock problem would be solved
package io.github.spitmaster.warlock.handler;
import org.aopalliance.intercept.MethodInvocation;
import org.slf4j.Logger;
/**
* 忽略超时的情况
* 等待超时: 继续执行
* 执行超时: 任然返回
*
* @author zhouyijin
*/
public enum IgnoreTimeoutHandler implements WaitTimeoutHandler, LeaseTimeoutHandler {
//单例
INSTANCE;
private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(IgnoreTimeoutHandler.class);
@Override
public Object handleWaitTimeout(MethodInvocation methodInvocation) throws Throwable {
LOGGER.warn("IgnoreTimeoutHandler wait timeout; timeout from {}", methodInvocation.getMethod().getName());
return methodInvocation.proceed();
}
@Override
public Object handleLeaseTimeout(MethodInvocation methodInvocation, Object result) throws Throwable {
LOGGER.warn("IgnoreTimeoutHandler lease timeout; timeout from {}", methodInvocation.getMethod().getName());
return result;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy