本文整理汇总了Java中org.apache.ignite.configuration.CacheConfiguration.setInterceptor方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setInterceptor方法的具体用法?Java CacheConfiguration.setInterceptor怎么用?Java CacheConfiguration.setInterceptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.CacheConfiguration
的用法示例。
在下文中一共展示了CacheConfiguration.setInterceptor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildCacheConfigurationRestricted
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** */
private CacheConfiguration buildCacheConfigurationRestricted(String cacheName, boolean readThrough,
boolean interceptor, boolean hasQueryEntity) {
CacheConfiguration cfg = new CacheConfiguration<Integer, Person>()
.setName(cacheName)
.setCacheMode(CacheMode.PARTITIONED)
.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
if (readThrough) {
cfg.setCacheStoreFactory(singletonFactory(new TestStore()));
cfg.setReadThrough(true);
}
if (interceptor)
cfg.setInterceptor(new TestInterceptor());
if (hasQueryEntity) {
cfg.setQueryEntities(F.asList(new QueryEntity(Integer.class, Person.class)
.setNotNullFields(Collections.singleton("name"))));
}
return cfg;
}
示例2: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
assertNotNull(interceptor);
ccfg.setInterceptor(interceptor);
if (!storeEnabled()) {
ccfg.setCacheStoreFactory(null);
ccfg.setReadThrough(false);
ccfg.setWriteThrough(false);
}
return ccfg;
}
示例3: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
*
* @param cacheMode Cache mode.
* @param backups Number of backups.
* @param atomicityMode Cache atomicity mode.
* @param store If {@code true} configures dummy cache store.
* @return Cache configuration.
*/
protected CacheConfiguration<Object, Object> cacheConfiguration(
CacheMode cacheMode,
int backups,
CacheAtomicityMode atomicityMode,
boolean store) {
CacheConfiguration<TestKey, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfg.setAtomicityMode(atomicityMode);
ccfg.setCacheMode(cacheMode);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
if (cacheMode == PARTITIONED)
ccfg.setBackups(backups);
if (store) {
ccfg.setCacheStoreFactory(new TestStoreFactory());
ccfg.setReadThrough(true);
ccfg.setWriteThrough(true);
}
ccfg.setInterceptor(new TestInterceptor());
return (CacheConfiguration)ccfg;
}
示例4: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration() throws Exception {
CacheConfiguration ccfg = defaultCacheConfiguration();
assertTrue(ccfg.isCopyOnRead());
interceptor = new Interceptor();
ccfg.setInterceptor(interceptor);
ccfg.setAtomicityMode(atomicityMode());
ccfg.setCacheMode(cacheMode());
ccfg.setNearConfiguration(null);
return ccfg;
}
示例5: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param atomicityMode Cache atomicity mode.
* @param store If {@code true} configures dummy cache store.
* @return Cache configuration.
*/
protected CacheConfiguration<Object, Object> cacheConfiguration(
CacheAtomicityMode atomicityMode,
boolean store) {
CacheConfiguration<TestKey, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfg.setAtomicityMode(atomicityMode);
ccfg.setCacheMode(LOCAL);
if (store) {
ccfg.setCacheStoreFactory(new TestStoreFactory());
ccfg.setReadThrough(true);
ccfg.setWriteThrough(true);
}
ccfg.setInterceptor(new TestInterceptor());
return (CacheConfiguration)ccfg;
}
示例6: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(final String igniteInstanceName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
final CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(CACHE_NAME);
assertNotNull(interceptor);
ccfg.setInterceptor(interceptor);
ccfg.setAtomicityMode(atomicityMode());
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setRebalanceMode(SYNC);
ccfg.setBackups(2);
cfg.setCacheConfiguration(ccfg);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
return cfg;
}
示例7: apply
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param config the akka configuration object
* @param actorSystem the akk actor system
* @return the created journal and sequence ignite caches†
*/
@Override
public JournalCaches apply(Config config, ActorSystem actorSystem) {
final IgniteExtension extension = IgniteExtensionProvider.EXTENSION.get(actorSystem);
final String cachePrefix = config.getString(CACHE_PREFIX_PROPERTY);
final int cacheBackups = config.getInt(CACHE_BACKUPS);
// cache configuration
final CacheConfiguration<Long, JournalItem> eventStore = new CacheConfiguration();
eventStore.setCopyOnRead(false);
if (cacheBackups > 0) {
eventStore.setBackups(cacheBackups);
} else {
eventStore.setBackups(1);
}
eventStore.setAtomicityMode(CacheAtomicityMode.ATOMIC);
eventStore.setName(cachePrefix);
eventStore.setCacheMode(CacheMode.PARTITIONED);
eventStore.setReadFromBackup(true);
eventStore.setIndexedTypes(Long.class, JournalItem.class);
eventStore.setIndexedTypes(String.class, JournalItem.class);
eventStore.setInterceptor(new JournalStoreInterceptor());
//sequence Number Tracking
final CacheConfiguration<String, Long> squenceNumberTrack = new CacheConfiguration();
squenceNumberTrack.setCopyOnRead(false);
if (cacheBackups > 0) {
squenceNumberTrack.setBackups(cacheBackups);
} else {
squenceNumberTrack.setBackups(1);
}
squenceNumberTrack.setAtomicityMode(CacheAtomicityMode.ATOMIC);
squenceNumberTrack.setName("sequenceNumberTrack");
squenceNumberTrack.setCacheMode(CacheMode.PARTITIONED);
squenceNumberTrack.setReadFromBackup(true);
return JournalCaches.builder()
.journalCache(extension.getIgnite().getOrCreateCache(eventStore))
.sequenceCache(extension.getIgnite().getOrCreateCache(squenceNumberTrack))
.build();
}
示例8: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration(IgniteConfiguration cfg, String cacheName) {
CacheConfiguration cc = super.cacheConfiguration(cfg, cacheName);
cc.setInterceptor(new TestInterceptor());
return cc;
}
示例9: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param atomicityMode Cache atomicity mode.
* @param testPrimitives {@code True} if test interceptor with primitive values.
* @return Cache configuration.
*/
private CacheConfiguration cacheConfiguration(CacheAtomicityMode atomicityMode, boolean testPrimitives) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setAtomicityMode(atomicityMode);
ccfg.setInterceptor(testPrimitives ? new TestInterceptor2() : new TestInterceptor1());
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setBackups(1);
return ccfg;
}
示例10: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration() {
CacheConfiguration cc = super.cacheConfiguration();
cc.setInterceptor(new TestInterceptor());
return cc;
}
示例11: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setDiscoverySpi(new TcpDiscoverySpi());
CacheConfiguration ccfg = defaultCacheConfiguration();
ccfg.setCacheMode(PARTITIONED);
ccfg.setWriteBehindEnabled(writeBehind);
ccfg.setCacheMode(CacheMode.PARTITIONED);
ccfg.setName(CACHE_NAME);
TestStore store = new TestStore();
ccfg.setCacheStoreFactory(singletonFactory(store));
ccfg.setReadThrough(true);
ccfg.setWriteThrough(true);
ccfg.setLoadPreviousValue(true);
lifecycleAwares.add(store.lifecycleAware);
TestAffinityFunction affinity = new TestAffinityFunction();
ccfg.setAffinity(affinity);
lifecycleAwares.add(affinity);
TestEvictionPolicy evictionPlc = new TestEvictionPolicy();
ccfg.setEvictionPolicy(evictionPlc);
ccfg.setOnheapCacheEnabled(true);
lifecycleAwares.add(evictionPlc);
if (near) {
TestEvictionPolicy nearEvictionPlc = new TestEvictionPolicy();
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
nearCfg.setNearEvictionPolicy(nearEvictionPlc);
ccfg.setNearConfiguration(nearCfg);
lifecycleAwares.add(nearEvictionPlc);
}
TestEvictionFilter evictionFilter = new TestEvictionFilter();
ccfg.setEvictionFilter(evictionFilter);
lifecycleAwares.add(evictionFilter);
TestAffinityKeyMapper mapper = new TestAffinityKeyMapper();
ccfg.setAffinityMapper(mapper);
lifecycleAwares.add(mapper);
TestInterceptor interceptor = new TestInterceptor();
lifecycleAwares.add(interceptor);
ccfg.setInterceptor(interceptor);
TestTopologyValidator topValidator = new TestTopologyValidator();
lifecycleAwares.add(topValidator);
ccfg.setTopologyValidator(topValidator);
cfg.setCacheConfiguration(ccfg);
return cfg;
}