use of org.infinispan.commons.marshall.StreamingMarshaller in project infinispan by infinispan.
the class InternalCacheFactory method createAndWire.
private AdvancedCache<K, V> createAndWire(Configuration configuration, GlobalComponentRegistry globalComponentRegistry, String cacheName) {
StreamingMarshaller marshaller = globalComponentRegistry.getOrCreateComponent(StreamingMarshaller.class, KnownComponentNames.INTERNAL_MARSHALLER);
AdvancedCache<K, V> cache = new CacheImpl<>(cacheName);
// We can optimize REPL reads that meet some criteria. This allows us to bypass interceptor chain
if (configuration.clustering().cacheMode().isReplicated() && !configuration.persistence().usingStores() && !configuration.transaction().transactionMode().isTransactional() && configuration.clustering().stateTransfer().awaitInitialTransfer() && configuration.clustering().hash().capacityFactor() != 0f && !globalComponentRegistry.getGlobalConfiguration().isZeroCapacityNode()) {
cache = new GetReplCache<>(new CacheImpl<>(cacheName));
if (configuration.statistics().available()) {
cache = new StatsCache<>(cache);
}
if (configuration.clustering().partitionHandling().whenSplit() != PartitionHandling.ALLOW_READ_WRITES) {
cache = new PartitionHandlingCache<>(cache);
}
}
AdvancedCache<K, V> encodedCache = buildEncodingCache(cache);
// TODO Register the cache without encoding in the component registry
bootstrap(cacheName, encodedCache, configuration, globalComponentRegistry, marshaller);
if (marshaller != null) {
componentRegistry.wireDependencies(marshaller, false);
}
return encodedCache;
}
use of org.infinispan.commons.marshall.StreamingMarshaller in project infinispan by infinispan.
the class StoreAsBinaryTest method testEqualsAndHashCode.
public void testEqualsAndHashCode() throws Exception {
StreamingMarshaller marshaller = extractGlobalMarshaller(manager(0));
CountMarshallingPojo pojo = new CountMarshallingPojo(POJO_NAME, 1);
WrappedBytes wb = new WrappedByteArray(marshaller.objectToByteBuffer(pojo));
WrappedBytes wb2 = new WrappedByteArray(marshaller.objectToByteBuffer(pojo));
assertEquals(wb2.hashCode(), wb.hashCode());
assertEquals(wb, wb2);
}
use of org.infinispan.commons.marshall.StreamingMarshaller in project infinispan by infinispan.
the class ExtendedStatisticInterceptor method replaceRpcManager.
private void replaceRpcManager() {
RpcManager oldRpcManager = componentRegistry.getComponent(RpcManager.class).running();
StreamingMarshaller marshaller = componentRegistry.getComponent(KnownComponentNames.INTERNAL_MARSHALLER, StreamingMarshaller.class).running();
if (oldRpcManager == null) {
// local mode
return;
}
RpcManager newRpcManager = new ExtendedStatisticRpcManager(oldRpcManager, cacheStatisticManager, timeService, marshaller);
log.replaceComponent("RpcManager", oldRpcManager, newRpcManager);
componentRegistry.replaceComponent(RpcManager.class.getName(), newRpcManager, false);
this.rpcManager = newRpcManager;
}
Aggregations