public static <T> T getValue(ThreadLocal<T> variable, Thread key) {
		try {
			Field field = Thread.class.getDeclaredField("threadLocals");
			field.setAccessible(true);
			Object entryMap = field.get(key);
			if (entryMap == null)
				return null;
			Method getEntryMethod = entryMap.getClass().getDeclaredMethod("getEntry", ThreadLocal.class);
			getEntryMethod.setAccessible(true);
			Object entry = getEntryMethod.invoke(entryMap, variable);
			if (entry == null)
				return null;
			Field valueField = entry.getClass().getDeclaredField("value");
			valueField.setAccessible(true);

			return (T) valueField.get(entry);
		} catch (NoSuchFieldException e) {
			throw new RuntimeException(e);
		} catch (IllegalAccessException e) {
			throw new RuntimeException(e);
		} catch (NoSuchMethodException e) {
			throw new RuntimeException(e);
		} catch (InvocationTargetException e) {
			throw new RuntimeException(e);
		}
	}