public ClusteredEventReplicator(Ehcache cache, TerracottaConfiguration.ValueMode valueMode) { this.valueMode = valueMode; switch (valueMode) { case IDENTITY: this.dsoSerialization = null; this.elementSerialization = null; break; case SERIALIZATION: this.dsoSerialization = new DsoSerializationStrategy(); this.elementSerialization = new ElementSerializationStrategy(); break; default: throw new UnsupportedOperationException("Value mode " + valueMode + " isn't supported"); } initializeOnLoad(); initializeTransients(cache); }
private static DsoSerializationStrategy getSingletonDsoSerializationStrategy() { ConcurrentMap<String, Object> root = new ConcurrentDistributedMap<String, Object>(LockType.WRITE, new HashcodeLockStrategy(), 8); ManagerUtil.beginLock(ROOT_NAME_UTILITIES, Manager.LOCK_TYPE_WRITE); try { root = (ConcurrentMap<String, Object>) ManagerUtil.lookupOrCreateRoot(ROOT_NAME_UTILITIES, root); root.putIfAbsent(DsoSerializationStrategy.class.getName(), new DsoSerializationStrategy()); setNotClearable(root); } finally { ManagerUtil.commitLock(ROOT_NAME_UTILITIES, Manager.LOCK_TYPE_WRITE); } return (DsoSerializationStrategy) root.get(DsoSerializationStrategy.class.getName()); }