use of org.infinispan.persistence.spi.CacheWriter in project infinispan by infinispan.
the class NonBlockingStoreAdapter method determineCharacteristics.
private static Set<Characteristic> determineCharacteristics(Object storeImpl) {
EnumSet<Characteristic> characteristics;
if (storeImpl instanceof SegmentedAdvancedLoadWriteStore) {
characteristics = EnumSet.of(Characteristic.SEGMENTABLE, Characteristic.EXPIRATION, Characteristic.BULK_READ);
} else {
characteristics = EnumSet.noneOf(Characteristic.class);
if (storeImpl instanceof AdvancedCacheLoader) {
characteristics.add(Characteristic.BULK_READ);
} else if (!(storeImpl instanceof CacheLoader)) {
characteristics.add(Characteristic.WRITE_ONLY);
}
if (storeImpl instanceof AdvancedCacheWriter) {
characteristics.add(Characteristic.EXPIRATION);
} else if (!(storeImpl instanceof CacheWriter)) {
characteristics.add(Characteristic.READ_ONLY);
}
}
Store storeAnnotation = storeImpl.getClass().getAnnotation(Store.class);
if (storeAnnotation != null && storeAnnotation.shared()) {
characteristics.add(Characteristic.SHAREABLE);
}
// Transactional is a special interface that could be true on a segment or not segmented store both
if (storeImpl instanceof TransactionalCacheWriter) {
characteristics.add(Characteristic.TRANSACTIONAL);
}
return characteristics;
}
use of org.infinispan.persistence.spi.CacheWriter 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.spi.CacheWriter 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();
}
Aggregations