use of org.infinispan.persistence.manager.PersistenceManagerImpl in project infinispan by infinispan.
the class TestingUtil method getStore.
@SuppressWarnings({ "unchecked", "unchecked cast" })
public static <T extends NonBlockingStore<K, V>, K, V> T getStore(Cache<K, V> cache, int position, boolean unwrapped) {
PersistenceManagerImpl persistenceManager = getActualPersistenceManager(cache);
NonBlockingStore<K, V> nonBlockingStore = persistenceManager.<K, V>getAllStores(characteristics -> !characteristics.contains(NonBlockingStore.Characteristic.WRITE_ONLY)).get(position);
if (unwrapped && nonBlockingStore instanceof DelegatingNonBlockingStore) {
nonBlockingStore = ((DelegatingNonBlockingStore<K, V>) nonBlockingStore).delegate();
}
return (T) nonBlockingStore;
}
use of org.infinispan.persistence.manager.PersistenceManagerImpl in project infinispan by infinispan.
the class TestingUtil method getFirstLoader.
public static <T extends CacheLoader<K, V>, K, V> T getFirstLoader(Cache<K, V> cache) {
PersistenceManagerImpl persistenceManager = getActualPersistenceManager(cache);
NonBlockingStore<K, V> nonBlockingStore = persistenceManager.<K, V>getAllStores(characteristics -> !characteristics.contains(NonBlockingStore.Characteristic.WRITE_ONLY)).get(0);
// noinspection unchecked
return (T) ((NonBlockingStoreAdapter<K, V>) nonBlockingStore).loader();
}
use of org.infinispan.persistence.manager.PersistenceManagerImpl in project infinispan by infinispan.
the class TestingUtil method getFirstTxWriter.
@SuppressWarnings("unchecked")
public static <T extends CacheWriter<K, V>, K, V> T getFirstTxWriter(Cache<K, V> cache) {
PersistenceManagerImpl persistenceManager = getActualPersistenceManager(cache);
NonBlockingStore<K, V> nonBlockingStore = persistenceManager.<K, V>getAllStores(characteristics -> characteristics.contains(NonBlockingStore.Characteristic.TRANSACTIONAL)).get(0);
// TODO: Once stores convert to non blocking implementations this will change
return (T) ((NonBlockingStoreAdapter<K, V>) nonBlockingStore).transactionalStore();
}
use of org.infinispan.persistence.manager.PersistenceManagerImpl in project infinispan by infinispan.
the class TestingUtil method getWriter.
public static <T extends CacheWriter<K, V>, K, V> T getWriter(Cache<K, V> cache, int position) {
PersistenceManagerImpl persistenceManager = getActualPersistenceManager(cache);
NonBlockingStore<K, V> nonBlockingStore = persistenceManager.<K, V>getAllStores(characteristics -> !characteristics.contains(NonBlockingStore.Characteristic.READ_ONLY)).get(position);
// TODO: Once stores convert to non blocking implementations this will change
return (T) ((NonBlockingStoreAdapter<K, V>) nonBlockingStore).writer();
}
use of org.infinispan.persistence.manager.PersistenceManagerImpl in project infinispan by infinispan.
the class JCache method addCacheLoaderAdapter.
protected void addCacheLoaderAdapter(CacheLoader<K, V> cacheLoader) {
PersistenceManagerImpl persistenceManager = (PersistenceManagerImpl) cache.getComponentRegistry().getComponent(PersistenceManager.class);
JCacheLoaderAdapter<K, V> adapter = getCacheLoaderAdapter(persistenceManager);
adapter.setDataConversion(cache.getKeyDataConversion(), cache.getValueDataConversion());
adapter.setCacheLoader(jcacheLoader);
adapter.setExpiryPolicy(expiryPolicy);
}
Aggregations