CentralizedThreadLocal extends ThreadLocal<T> { @Override public int hashCode() { return _hashCode; } CentralizedThreadLocal(boolean shortLived);  CentralizedThreadLocal(String name);  CentralizedThreadLocal(String name, Supplier<T> supplier);  CentralizedThreadLocal(
		String name, Supplier<T> supplier, boolean shortLived);  CentralizedThreadLocal(
		String name, Supplier<T> supplier, Function<T, T> copyFunction,
		boolean shortLived); static void clearLongLivedThreadLocals(); static void clearShortLivedThreadLocals(); static Map<CentralizedThreadLocal<?>, Object> getLongLivedThreadLocals(); static Map<CentralizedThreadLocal<?>, Object> getShortLivedThreadLocals(); static void setThreadLocals(
		Map<CentralizedThreadLocal<?>, Object> longLivedCentralizedThreadLocals,
		Map<CentralizedThreadLocal<?>, Object>
			shortLivedCentralizedThreadLocals); @Override boolean equals(Object object); @Override T get(); @Override int hashCode(); @Override void remove(); @Override void set(T value); SafeClosable setWithSafeClosable(T value); @Override String toString();  }
@Test public void testHashCode() { AtomicInteger longLivedNextHasCode = ReflectionTestUtil.getFieldValue( CentralizedThreadLocal.class, "_longLivedNextHasCode"); AtomicInteger shortLivedNextHasCode = ReflectionTestUtil.getFieldValue( CentralizedThreadLocal.class, "_shortLivedNextHasCode"); Random random = new Random(); int longLivedHashCode = random.nextInt(); int shortLivedHashCode = random.nextInt(); longLivedNextHasCode.set(longLivedHashCode); shortLivedNextHasCode.set(shortLivedHashCode); CentralizedThreadLocal<?> longLivedCentralizedThreadLocal = new CentralizedThreadLocal<>(false); CentralizedThreadLocal<?> shortLivedCentralizedThreadLocal = new CentralizedThreadLocal<>(true); Assert.assertEquals( longLivedHashCode, longLivedCentralizedThreadLocal.hashCode()); Assert.assertEquals( shortLivedHashCode, shortLivedCentralizedThreadLocal.hashCode()); longLivedCentralizedThreadLocal = new CentralizedThreadLocal<>(false); shortLivedCentralizedThreadLocal = new CentralizedThreadLocal<>(true); int hashIncrement = ReflectionTestUtil.getFieldValue( CentralizedThreadLocal.class, "_HASH_INCREMENT"); Assert.assertEquals( longLivedHashCode + hashIncrement, longLivedCentralizedThreadLocal.hashCode()); Assert.assertEquals( shortLivedHashCode + hashIncrement, shortLivedCentralizedThreadLocal.hashCode()); Assert.assertEquals( longLivedHashCode + (hashIncrement * 2), longLivedNextHasCode.get()); Assert.assertEquals( shortLivedHashCode + (hashIncrement * 2), shortLivedNextHasCode.get()); }