@Override public void initCachingTier(LowerCachingTier<?, ?> resource) { if (!createdStores.contains(resource)) { throw new IllegalArgumentException("Given caching tier is not managed by this provider : " + resource); } init((OffHeapStore<?, ?>) resource); } }
@Override public void initStore(Store<?, ?> resource) { if (!createdStores.contains(resource)) { throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } OffHeapStore<?, ?> offHeapStore = (OffHeapStore<?, ?>) resource; Serializer<?> keySerializer = offHeapStore.keySerializer; if (keySerializer instanceof StatefulSerializer) { ((StatefulSerializer)keySerializer).init(new TransientStateRepository()); } Serializer<?> valueSerializer = offHeapStore.valueSerializer; if (valueSerializer instanceof StatefulSerializer) { ((StatefulSerializer)valueSerializer).init(new TransientStateRepository()); } init(offHeapStore); }
private AuthoritativeTier<String, String> newStore(Long capacity, EvictionAdvisor<String, String> evictionAdvisor, ExpiryPolicy<? super String, ? super String> expiry, TimeSource timeSource) { Serializer<String> keySerializer = new JavaSerializer<>(getClass().getClassLoader()); Serializer<String> valueSerializer = new JavaSerializer<>(getClass().getClassLoader()); ResourcePools resourcePools = getOffHeapResourcePool(capacity); SizedResourcePool offheapPool = resourcePools.getPoolForResource(OFFHEAP); MemoryUnit unit = (MemoryUnit)offheapPool.getUnit(); Store.Configuration<String, String> config = new StoreConfigurationImpl<>(getKeyType(), getValueType(), evictionAdvisor, getClass().getClassLoader(), expiry, resourcePools, 0, keySerializer, valueSerializer); OffHeapStore<String, String> store = new OffHeapStore<>(config, timeSource, new TestStoreEventDispatcher<>(), unit .toBytes(offheapPool.getSize())); OffHeapStore.Provider.init(store); return store; }
@Override public void initStore(Store<?, ?> resource) { if (!createdStores.contains(resource)) { throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } OffHeapStore<?, ?> offHeapStore = (OffHeapStore<?, ?>) resource; Serializer<?> keySerializer = offHeapStore.keySerializer; if (keySerializer instanceof StatefulSerializer) { ((StatefulSerializer)keySerializer).init(new TransientStateRepository()); } Serializer<?> valueSerializer = offHeapStore.valueSerializer; if (valueSerializer instanceof StatefulSerializer) { ((StatefulSerializer)valueSerializer).init(new TransientStateRepository()); } init(offHeapStore); }
@Override public void initCachingTier(LowerCachingTier<?, ?> resource) { if (!createdStores.contains(resource)) { throw new IllegalArgumentException("Given caching tier is not managed by this provider : " + resource); } init((OffHeapStore<?, ?>) resource); } }
@Override protected OffHeapStore<String, String> createAndInitStore(TimeSource timeSource, ExpiryPolicy<? super String, ? super String> expiry) { try { SerializationProvider serializationProvider = new DefaultSerializationProvider(null); serializationProvider.start(providerContaining()); ClassLoader classLoader = getClass().getClassLoader(); Serializer<String> keySerializer = serializationProvider.createKeySerializer(String.class, classLoader); Serializer<String> valueSerializer = serializationProvider.createValueSerializer(String.class, classLoader); StoreConfigurationImpl<String, String> storeConfiguration = new StoreConfigurationImpl<>(String.class, String.class, null, classLoader, expiry, null, 0, keySerializer, valueSerializer); OffHeapStore<String, String> offHeapStore = new OffHeapStore<>(storeConfiguration, timeSource, new TestStoreEventDispatcher<>(), MemoryUnit.MB .toBytes(1)); OffHeapStore.Provider.init(offHeapStore); return offHeapStore; } catch (UnsupportedTypeException e) { throw new AssertionError(e); } }
@Override protected OffHeapStore<String, byte[]> createAndInitStore(TimeSource timeSource, ExpiryPolicy<? super String, ? super byte[]> expiry, EvictionAdvisor<? super String, ? super byte[]> evictionAdvisor) { try { SerializationProvider serializationProvider = new DefaultSerializationProvider(null); serializationProvider.start(providerContaining()); ClassLoader classLoader = getClass().getClassLoader(); Serializer<String> keySerializer = serializationProvider.createValueSerializer(String.class, classLoader); Serializer<byte[]> valueSerializer = serializationProvider.createValueSerializer(byte[].class, classLoader); StoreConfigurationImpl<String, byte[]> storeConfiguration = new StoreConfigurationImpl<>(String.class, byte[].class, evictionAdvisor, getClass().getClassLoader(), expiry, null, 0, keySerializer, valueSerializer); OffHeapStore<String, byte[]> offHeapStore = new OffHeapStore<>(storeConfiguration, timeSource, new TestStoreEventDispatcher<>(), MemoryUnit.MB .toBytes(1)); OffHeapStore.Provider.init(offHeapStore); return offHeapStore; } catch (UnsupportedTypeException e) { throw new AssertionError(e); } }
public static void init(OffHeapStore<?, ?> offHeapStore) { OffHeapStore.Provider.init(offHeapStore); }
public static void init(OffHeapStore<?, ?> offHeapStore) { OffHeapStore.Provider.init(offHeapStore); }
public static void initStore(OffHeapStore<?, ?> offHeapStore) { OffHeapStore.Provider.init(offHeapStore); }