⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 threadlocals.java

📁 非常接近C/S操作方式的Java Ajax框架-ZK 用ZK框架使你的B/S应用程序更漂亮更易操作。 官网:www.zkoss.org
💻 JAVA
字号:
/* ThreadLocals.java{{IS_NOTE	Purpose:			Description:			History:		Thu Sep 21 10:07:46     2006, Created by henrichen}}IS_NOTECopyright (C) 2006 Potix Corporation. All Rights Reserved.{{IS_RIGHT}}IS_RIGHT*/package org.zkoss.lang;import java.lang.reflect.Field;/** * ThreadLocal related utilties. This implementation get the static  * ThreadLocal via reflection. * * @author henrichen */public class ThreadLocals {	/** Given class name and static ThreadLocal field name, return the associated ThreadLocal.	 * @param clsname the class name	 * @param fldname the ThreadLocal field name	 */	public static ThreadLocal getThreadLocal(String clsname, String fldname) {		try {			Class cls = Classes.forNameByThread(clsname);			return getThreadLocal(cls, fldname);		} catch (ClassNotFoundException ex) {			throw SystemException.Aide.wrap(ex);		}	}	/** Given class and static ThreadLocal field name, return the associated ThreadLocal.	 * @param cls the class	 * @param fldname the ThreadLocal field name.	 */	public static ThreadLocal getThreadLocal(Class cls, String fldname) {		try {			Field fld = cls.getDeclaredField(fldname);			fld.setAccessible(true);			return (ThreadLocal) fld.get(cls); //class static field, a ThreadLocal		} catch (java.lang.NoSuchFieldException ex) {			throw SystemException.Aide.wrap(ex);		} catch (java.lang.IllegalAccessException ex) {			throw SystemException.Aide.wrap(ex);		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -