本文整理了Java中org.springframework.core.NamedThreadLocal.set()
方法的一些代码示例,展示了NamedThreadLocal.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NamedThreadLocal.set()
方法的具体详情如下:
包路径:org.springframework.core.NamedThreadLocal
类名称:NamedThreadLocal
方法名:set
暂无
代码示例来源:origin: a466350665/smart
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
long beginTime = System.currentTimeMillis();// 1、开始时间
startTimeThreadLocal.set(beginTime);// 线程绑定变量(该数据只有当前请求的线程可见)
return true;// 继续流程
}
代码示例来源:origin: spring-projects/spring-framework
static InjectionPoint setCurrentInjectionPoint(@Nullable InjectionPoint injectionPoint) {
InjectionPoint old = currentInjectionPoint.get();
if (injectionPoint != null) {
currentInjectionPoint.set(injectionPoint);
}
else {
currentInjectionPoint.remove();
}
return old;
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Obtain a bean instance from the given supplier.
* @param instanceSupplier the configured supplier
* @param beanName the corresponding bean name
* @return a BeanWrapper for the new instance
* @since 5.0
* @see #getObjectForBeanInstance
*/
protected BeanWrapper obtainFromSupplier(Supplier<?> instanceSupplier, String beanName) {
Object instance;
String outerBean = this.currentlyCreatedBean.get();
this.currentlyCreatedBean.set(beanName);
try {
instance = instanceSupplier.get();
}
finally {
if (outerBean != null) {
this.currentlyCreatedBean.set(outerBean);
}
else {
this.currentlyCreatedBean.remove();
}
}
if (instance == null) {
instance = new NullBean();
}
BeanWrapper bw = new BeanWrapperImpl(instance);
initBeanWrapper(bw);
return bw;
}
代码示例来源:origin: org.springframework/spring-beans
static InjectionPoint setCurrentInjectionPoint(@Nullable InjectionPoint injectionPoint) {
InjectionPoint old = currentInjectionPoint.get();
if (injectionPoint != null) {
currentInjectionPoint.set(injectionPoint);
}
else {
currentInjectionPoint.remove();
}
return old;
}
代码示例来源:origin: org.springframework/spring-beans
/**
* Obtain a bean instance from the given supplier.
* @param instanceSupplier the configured supplier
* @param beanName the corresponding bean name
* @return a BeanWrapper for the new instance
* @since 5.0
* @see #getObjectForBeanInstance
*/
protected BeanWrapper obtainFromSupplier(Supplier<?> instanceSupplier, String beanName) {
Object instance;
String outerBean = this.currentlyCreatedBean.get();
this.currentlyCreatedBean.set(beanName);
try {
instance = instanceSupplier.get();
}
finally {
if (outerBean != null) {
this.currentlyCreatedBean.set(outerBean);
}
else {
this.currentlyCreatedBean.remove();
}
}
if (instance == null) {
instance = new NullBean();
}
BeanWrapper bw = new BeanWrapperImpl(instance);
initBeanWrapper(bw);
return bw;
}
代码示例来源:origin: Cosium/spring-data-jpa-entity-graph
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
if (invocation.getMethod().getName().startsWith(FETCH_METHOD_NAME_PREFIX)) {
IS_COUNT_QUERY.set(true);
}
try {
return invocation.proceed();
} finally {
IS_COUNT_QUERY.set(false);
}
}
}
代码示例来源:origin: apache/servicemix-bundles
static InjectionPoint setCurrentInjectionPoint(InjectionPoint injectionPoint) {
InjectionPoint old = currentInjectionPoint.get();
if (injectionPoint != null) {
currentInjectionPoint.set(injectionPoint);
}
else {
currentInjectionPoint.remove();
}
return old;
}
代码示例来源:origin: com.wuyushuo/vplus-data
public void setUpDataSourceTableLookup(Lookup lookup) {
if (lookup != null) {
if (!lookup.isShard()) {
this.lookup.set(lookup);
} else {
String shardType = lookup.getShardType();
ShardStrategy shardStrategy = (ShardStrategy)this.shardStrategies.get(shardType);
if (shardStrategy == null) {
throw new IllegalArgumentException("未确定散表算法");
} else {
ShardStrategy.DataTableName dataTableName = shardStrategy.handle(lookup.getTableName(), lookup.getDataSourceKey(), lookup.getTableShardNum(), lookup.getDbShardNum(), lookup.getShardValue());
lookup.setDataTableName(dataTableName);
this.lookup.set(lookup);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!