Search in sources :

Example 1 with StreamingMarshaller

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;
}
Also used : StreamingMarshaller(org.infinispan.commons.marshall.StreamingMarshaller) CacheImpl(org.infinispan.cache.impl.CacheImpl) SimpleCacheImpl(org.infinispan.cache.impl.SimpleCacheImpl)

Example 2 with StreamingMarshaller

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);
}
Also used : CountMarshallingPojo(org.infinispan.test.data.CountMarshallingPojo) WrappedByteArray(org.infinispan.commons.marshall.WrappedByteArray) WrappedBytes(org.infinispan.commons.marshall.WrappedBytes) StreamingMarshaller(org.infinispan.commons.marshall.StreamingMarshaller)

Example 3 with StreamingMarshaller

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;
}
Also used : RpcManager(org.infinispan.remoting.rpc.RpcManager) StreamingMarshaller(org.infinispan.commons.marshall.StreamingMarshaller)

Aggregations

StreamingMarshaller (org.infinispan.commons.marshall.StreamingMarshaller)3 CacheImpl (org.infinispan.cache.impl.CacheImpl)1 SimpleCacheImpl (org.infinispan.cache.impl.SimpleCacheImpl)1 WrappedByteArray (org.infinispan.commons.marshall.WrappedByteArray)1 WrappedBytes (org.infinispan.commons.marshall.WrappedBytes)1 RpcManager (org.infinispan.remoting.rpc.RpcManager)1 CountMarshallingPojo (org.infinispan.test.data.CountMarshallingPojo)1