use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.
the class BaseClusteredExtendedStatisticTest method assertNoTxStats.
private void assertNoTxStats() {
final ExtendedStatisticInterceptor[] statisticInterceptors = new ExtendedStatisticInterceptor[caches().size()];
for (int i = 0; i < caches().size(); ++i) {
statisticInterceptors[i] = getExtendedStatistic(cache(i));
}
eventually(() -> {
for (ExtendedStatisticInterceptor interceptor : statisticInterceptors) {
if (interceptor.getCacheStatisticManager().hasPendingTransactions()) {
return false;
}
}
return true;
});
}
use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.
the class BaseTxClusterExtendedStatisticLogicTest method createCacheManagers.
@Override
protected void createCacheManagers() throws Throwable {
for (int i = 0; i < NUM_NODES; ++i) {
ConfigurationBuilder builder = getDefaultClusteredCacheConfig(cacheMode, true);
builder.locking().isolationLevel(IsolationLevel.READ_COMMITTED).lockAcquisitionTimeout(0);
builder.clustering().hash().numOwners(1);
builder.transaction().recovery().disable();
extendedStatisticInterceptors[i] = new ExtendedStatisticInterceptor();
builder.customInterceptors().addInterceptor().interceptor(extendedStatisticInterceptors[i]).after(TxInterceptor.class);
addClusterEnabledCacheManager(TestDataSCI.INSTANCE, builder);
}
waitForClusterToForm();
for (int i = 0; i < NUM_NODES; ++i) {
TestingUtil.replaceComponent(cacheManagers.get(i), TimeService.class, TEST_TIME_SERVICE, true);
lockManagers[i] = extractLockManager(cache(i));
ExtendedStatisticInterceptor interceptor = extendedStatisticInterceptors[i];
CacheStatisticManager manager = extractField(interceptor, "cacheStatisticManager");
CacheStatisticCollector collector = extractField(manager, "cacheStatisticCollector");
ConcurrentGlobalContainer globalContainer = extractField(collector, "globalContainer");
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", lockManagers[i], ExtendedStatisticLockManager.class);
replaceField(TEST_TIME_SERVICE, "timeService", extractComponent(cache(i), RpcManager.class), ExtendedStatisticRpcManager.class);
transactionTrackInterceptors[i] = TransactionTrackInterceptor.injectInCache(cache(i));
}
}
use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.
the class LocalTxClusterExtendedStatisticLogicTest method createCacheManager.
@Override
protected EmbeddedCacheManager createCacheManager() {
ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.LOCAL, true);
builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ).lockAcquisitionTimeout(0);
builder.clustering().hash().numOwners(1);
builder.transaction().recovery().disable();
extendedStatisticInterceptor = new ExtendedStatisticInterceptor();
builder.customInterceptors().addInterceptor().interceptor(extendedStatisticInterceptor).after(TxInterceptor.class);
return TestCacheManagerFactory.createCacheManager(builder);
}
use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.
the class OptimisticLockingTxClusterExtendedStatisticLogicTest 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(TestingUtil.shortTimeoutMillis());
builder.transaction().recovery().disable();
builder.transaction().lockingMode(LockingMode.OPTIMISTIC);
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 testRemoveUnexistingEntry.
public void testRemoveUnexistingEntry() {
assertEmpty(KEY_1);
ExtendedStatisticInterceptor statisticInterceptor = getExtendedStatistic(cache);
cache.remove(KEY_1);
assertCacheValue(KEY_1, null);
assertNoTransactions();
Assert.assertFalse(statisticInterceptor.getCacheStatisticManager().hasPendingTransactions());
}
Aggregations