I just attempted to make an object distributed which contains a ConcurrentHashMap that uses java.lang.Class as keys (and values):
Code:
ConcurrentHashMap<Class<?>, Class<?>>()
Once this ConcurrentHashMap is made distributed, an attempt to put anything into it results in this exception:
Code:
java.lang.ClassCastException: java.lang.Class cannot be cast to com.tc.object.bytecode.Manageable
at com.tc.object.bytecode.ManagerImpl.shareObjectIfNecessary(ManagerImpl.java:548)
at com.tc.object.bytecode.ManagerUtil.shareObjectIfNecessary(ManagerUtil.java:132)
at java.util.concurrent.ConcurrentHashMap.__tc_hash(ConcurrentHashMap.java)
at java.util.concurrent.ConcurrentHashMap.__tc_hash(ConcurrentHashMap.java)
at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:880)
...
Is it not possible to use java.lang.Class as map keys in Terracotta, or am I configuring something wrong here? Isn't Class a Terracotta literal? Are literals not supports as map keys?