use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.
the class BaseClusteredExtendedStatisticTest method getExtendedStatistic.
private ExtendedStatisticInterceptor getExtendedStatistic(Cache<?, ?> cache) {
AsyncInterceptorChain interceptorChain = cache.getAdvancedCache().getAsyncInterceptorChain();
ExtendedStatisticInterceptor extendedStatisticInterceptor = interceptorChain.findInterceptorExtending(ExtendedStatisticInterceptor.class);
if (extendedStatisticInterceptor != null) {
extendedStatisticInterceptor.resetStatistics();
}
return extendedStatisticInterceptor;
}
use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.
the class BaseClusteredExtendedStatisticTest method createCacheManagers.
@Override
protected void createCacheManagers() throws Throwable {
for (int i = 0; i < 2; ++i) {
ConfigurationBuilder builder = getDefaultClusteredCacheConfig(mode, true);
builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ);
builder.clustering().hash().numOwners(1);
builder.transaction().recovery().disable();
builder.customInterceptors().addInterceptor().interceptor(new ExtendedStatisticInterceptor()).position(InterceptorConfiguration.Position.FIRST);
addClusterEnabledCacheManager(builder);
}
waitForClusterToForm();
replaceAllPerCacheInboundInvocationHandler();
}
use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.
the class PessimisticLockingTxClusterExtendedStatisticLogicTest method createCacheManagers.
@Override
protected void createCacheManagers() {
for (int i = 0; i < NUM_NODES; ++i) {
ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true);
builder.clustering().hash().numSegments(1).consistentHashFactory(new ReplicatedControlledConsistentHashFactory(0));
//
builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ).lockAcquisitionTimeout(// the timeout are triggered by the TimeService!
60000);
builder.transaction().recovery().disable();
builder.transaction().lockingMode(LockingMode.PESSIMISTIC);
// builder.versioning().enable().scheme(VersioningScheme.SIMPLE);
extendedStatisticInterceptors[i] = new ExtendedStatisticInterceptor();
builder.customInterceptors().addInterceptor().interceptor(extendedStatisticInterceptors[i]).after(TxInterceptor.class);
addClusterEnabledCacheManager(builder);
}
waitForClusterToForm();
for (int i = 0; i < NUM_NODES; ++i) {
ExtendedStatisticInterceptor interceptor = extendedStatisticInterceptors[i];
CacheStatisticManager manager = extractField(interceptor, "cacheStatisticManager");
CacheStatisticCollector collector = extractField(manager, "cacheStatisticCollector");
ConcurrentGlobalContainer globalContainer = extractField(collector, "globalContainer");
ExtendedStatisticRpcManager rpcManager = (ExtendedStatisticRpcManager) extractComponent(cache(i), RpcManager.class);
ExtendedStatisticLockManager lockManager = (ExtendedStatisticLockManager) extractLockManager(cache(i));
lockManagers[i] = lockManager;
replaceField(TEST_TIME_SERVICE, "timeService", manager, CacheStatisticManager.class);
replaceField(TEST_TIME_SERVICE, "timeService", collector, CacheStatisticCollector.class);
replaceField(TEST_TIME_SERVICE, "timeService", globalContainer, ConcurrentGlobalContainer.class);
replaceField(TEST_TIME_SERVICE, "timeService", interceptor, ExtendedStatisticInterceptor.class);
replaceField(TEST_TIME_SERVICE, "timeService", lockManager, ExtendedStatisticLockManager.class);
replaceField(TEST_TIME_SERVICE, "timeService", rpcManager, ExtendedStatisticRpcManager.class);
controlledRpcManager[i] = ControlledRpcManager.replaceRpcManager(cache(i));
transactionTrackInterceptors[i] = TransactionTrackInterceptor.injectInCache(cache(i));
if (i == 0) {
LockManager actualLockManager = lockManager.getActual();
LockContainer container = extractField(actualLockManager, "lockContainer");
TestingUtil.inject(container, new WithinThreadExecutor(), lockManagerTimeService);
}
}
}
use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.
the class LocalExtendedStatisticTest method testRemoveIfPresent.
public void testRemoveIfPresent() {
assertEmpty(KEY_1);
ExtendedStatisticInterceptor statisticInterceptor = getExtendedStatistic(cache);
cache.put(KEY_1, VALUE_1);
assertCacheValue(KEY_1, VALUE_1);
cache.put(KEY_1, VALUE_2);
assertCacheValue(KEY_1, VALUE_2);
cache.remove(KEY_1, VALUE_1);
assertCacheValue(KEY_1, VALUE_2);
cache.remove(KEY_1, VALUE_2);
assertCacheValue(KEY_1, null);
assertNoTransactions();
Assert.assertFalse(statisticInterceptor.getCacheStatisticManager().hasPendingTransactions());
}
use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.
the class LocalExtendedStatisticTest method testPutIfAbsent.
public void testPutIfAbsent() {
assertEmpty(KEY_1, KEY_2);
ExtendedStatisticInterceptor statisticInterceptor = getExtendedStatistic(cache);
cache.put(KEY_1, VALUE_1);
assertCacheValue(KEY_1, VALUE_1);
cache.putIfAbsent(KEY_1, VALUE_2);
assertCacheValue(KEY_1, VALUE_1);
cache.put(KEY_1, VALUE_3);
assertCacheValue(KEY_1, VALUE_3);
cache.putIfAbsent(KEY_1, VALUE_4);
assertCacheValue(KEY_1, VALUE_3);
cache.putIfAbsent(KEY_2, VALUE_1);
assertCacheValue(KEY_2, VALUE_1);
assertNoTransactions();
Assert.assertFalse(statisticInterceptor.getCacheStatisticManager().hasPendingTransactions());
}
Aggregations