Source:
<code>AdvancedCache getCacheInstance(String cacheName, EmbeddedCacheManager cacheManager, Boolean skipCacheCheck, Boolean addToKnownCaches) { AdvancedCache cache = null; if (!skipCacheCheck) cache = knownCaches.get(cacheName); if (cache == null) { String validCacheName = cacheName.isEmpty() ? configuration.defaultCacheName() : cacheName; Cache<byte[], byte[]> tmpCache = SecurityActions.getCache(cacheManager, validCacheName); Configuration cacheConfiguration = SecurityActions.getCacheConfiguration(tmpCache.getAdvancedCache()); boolean compatibility = cacheConfiguration.compatibility().enabled(); Marshaller marshaller = cacheConfiguration.compatibility().marshaller(); boolean indexing = cacheConfiguration.indexing().index().isEnabled(); ComponentRegistry cacheComponentRegistry = SecurityActions.getCacheComponentRegistry(tmpCache.getAdvancedCache()); if (marshaller != null) { cacheComponentRegistry.wireDependencies(marshaller); } if (compatibility || indexing) { cache = tmpCache.getAdvancedCache().withFlags(Flag.OPERATION_HOTROD); if (compatibility && !indexing) { cache = cache.getAdvancedCache().withEncoder(new CompatModeEncoder(marshaller)); } if(compatibility && indexing) { if (marshaller instanceof BaseProtoStreamMarshaller) { cache = cache.getAdvancedCache().withEncoder(new ProtostreamEncoder(cacheManager)).withWrapper(new ProtostreamWrapper()); } else { cache = cache.getAdvancedCache().withEncoder(new CompatModeEncoder(marshaller)); <START> } <END> } if(!compatibility) { cache = cache.getAdvancedCache().withWrapper(new ProtostreamWrapper()); } } else cache = tmpCache.getAdvancedCache(); knownCacheConfigurations.put(cacheName, cacheConfiguration); knownCacheRegistries.put(cacheName, SecurityActions.getCacheComponentRegistry(tmpCache.getAdvancedCache())); if (addToKnownCaches) { knownCaches.put(cacheName, cache); } tryRegisterMigrationManager(cacheName, cache); } return cache; }</code><technical_language>this is complete, in theory able get rid of OPERATION_ flags</technical_language>

Target:
AdvancedCache getCacheInstance(String cacheName, EmbeddedCacheManager cacheManager, Boolean skipCacheCheck, Boolean addToKnownCaches) { AdvancedCache cache = null; if (!skipCacheCheck) cache = knownCaches.get(cacheName); if (cache == null) { String validCacheName = cacheName.isEmpty() ? configuration.defaultCacheName() : cacheName; Cache<byte[], byte[]> tmpCache = SecurityActions.getCache(cacheManager, validCacheName); Configuration cacheConfiguration = SecurityActions.getCacheConfiguration(tmpCache.getAdvancedCache()); boolean compatibility = cacheConfiguration.compatibility().enabled(); Marshaller marshaller = cacheConfiguration.compatibility().marshaller(); boolean indexing = cacheConfiguration.indexing().index().isEnabled(); ComponentRegistry cacheComponentRegistry = SecurityActions.getCacheComponentRegistry(tmpCache.getAdvancedCache()); if (marshaller != null) { cacheComponentRegistry.wireDependencies(marshaller); } if (compatibility || indexing) { cache = tmpCache.getAdvancedCache().withFlags(Flag.OPERATION_HOTROD); if (compatibility && !indexing) { cache = cache.getAdvancedCache().withEncoding(CompatModeEncoder.class); } if (compatibility && indexing) { if (marshaller instanceof BaseProtoStreamMarshaller) { cache = cache.getAdvancedCache().withEncoding(ProtostreamCompatEncoder.class).withWrapping(ByteArrayWrapper.class, ProtostreamWrapper.class); } else { cache = cache.getAdvancedCache().withEncoding(CompatModeEncoder.class); } } if (!compatibility) { cache = cache.getAdvancedCache().withWrapping(ByteArrayWrapper.class, ProtostreamWrapper.class); } } else cache = tmpCache.getAdvancedCache(); knownCacheConfigurations.put(cacheName, cacheConfiguration); knownCacheRegistries.put(cacheName, SecurityActions.getCacheComponentRegistry(tmpCache.getAdvancedCache())); if (addToKnownCaches) { knownCaches.put(cacheName, cache); } tryRegisterMigrationManager(cacheName, cache); } return cache; }