惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
T
Tailwind CSS Blog
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
博客园 - 叶小钗
N
Netflix TechBlog - Medium
罗磊的独立博客
量子位
MyScale Blog
MyScale Blog
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
B
Blog
腾讯CDC
爱范儿
爱范儿
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
F
Fortinet All Blogs
雷峰网
雷峰网
G
Google Developers Blog
Google DeepMind News
Google DeepMind News

博客园 - sinxsoft

loss.py:result type Float can't be cast to the desired output type long int AttributeError: module 'numpy' has no attribute 'int'. 非root账号,要写入特定文件夹的处理措施 Docker 运行你的Springboot应用。 阿里巴巴中间件团队出品的开源软件以及商业云服务(转) storm 配置,呵呵。 dubbo+zookeeper集群配置 zookeeper分布式部署-mac先测试 tomcat8和7关于自定义tag的处理区别 每个程序员都必读的10篇文章 eclipse 引用项目(转) 债券发行价格招标和收益率招标:需要搞定 IIS之应用程序池-Web园-最大工作进程>1时系统出现问题 研究jBPM和NetBPM 研究:Microsoft Solution Framework SCRUM迭代增量式软件开发过程研究 多说多做多想。 架构师培训笔记: 从今天开始,向注册会计师进军。
Java 之ThreadLocal 对应C#之ThreadStatic
sinxsoft · 2014-09-11 · via 博客园 - sinxsoft

java:


public
class JForumExecutionContext { private static ThreadLocal userData = new ThreadLocal(); /** * Gets the execution context. * @return JForumExecutionContext */ public static JForumExecutionContext get() { JForumExecutionContext ex = (JForumExecutionContext)userData.get(); if (ex == null) { ex = new JForumExecutionContext(); userData.set(ex); } return ex; } /** * Checks if there is an execution context already set * @return <code>true</code> if there is an execution context * @see #get() */ public static boolean exists() { return (userData.get() != null); } }

 C#:  

[ThreadStatic]
private static Object StaticObject = new Object();