public static <T> ThreadLocal<T> newThreadLocal(final Class<? extends T> clazz) {
		return new ThreadLocal<T>() {
			@SuppressWarnings("rawtypes")
			@Override
			protected T initialValue() {
				try {
					return clazz.newInstance();
				} catch (Exception e) {
					if (MAKE_ACCESSIBLE) {
						Constructor[] constructors = clazz.getDeclaredConstructors();
						// try 0 length constructors
						for (Constructor c : constructors) {
							if (c.getParameterTypes().length == 0) {
								c.setAccessible(true);
								try {
									return clazz.newInstance();
								} catch (Exception e2) {
									// ignore
								}
							}
						}
					}
					throw new IciqlException(e,
							"Missing default constructor?  Exception trying to instantiate {0}: {1}",
							clazz.getName(), e.getMessage());
				}
			}
		};
	}