-
1. Re: Getting Commits/Rollbacks stats from TxInterceptor
dan.berindei Oct 20, 2011 6:04 PM (in response to renzos)TxInterceptor can be accessed through JMX, see https://github.com/infinispan/infinispan/blob/master/core/src/test/java/org/infinispan/jmx/TxInterceptorMBeanTest.java
-
2. Re: Getting Commits/Rollbacks stats from TxInterceptor
renzos Oct 21, 2011 4:56 AM (in response to dan.berindei)Thanks Dan for your answer but maybe I need few more tips as I'm new to JMX and I couldn't find step-by-step tutorials. Here an example of what I mean:
First of all I declare:
manager = new DefaultCacheManager("ConfigFile.xml");
Cache<Object, Object> cache = manager.getCache("myCache");
then I declare the TM:
TransactionManager tm = cache.getAdvancedCache().getTransactionManager();
Now what I would like to do is getting TxInterceptor stats on that TM. Using the example you suggested me I tried to put in my code the following code lines:
private static final String JMX_DOMAIN = MYCLASSNAME.class.getSimpleName();
private ObjectName txInterceptor;
private MBeanServer threadMBeanServer;
etc...
But even adding all the "imports" needed I get many errors
-
3. Re: Getting Commits/Rollbacks stats from TxInterceptor
dan.berindei Oct 23, 2011 6:19 AM (in response to renzos)What errors are you getting?
Keep in mind that the test depends on method getCacheObjectName() of class TestingUtil which is not in infinispan-core.jar since it's used only by the test suite.
-
4. Re: Getting Commits/Rollbacks stats from TxInterceptor
renzos Oct 24, 2011 3:43 AM (in response to dan.berindei)On the statement
"txInterceptor = getCacheObjectName(JMX_DOMAIN, "myCache(repl_sync)", "Transactions");
I get "cannot find symbol, method getCacheObjectName" and maybe that's the missing TestingUtil class, I hoped it was enough to put "import org.infinispan.test.TestingUtil.getCacheObjectName;" but if infinispan-core doesn't contain it... Do you know where I can download that library from?
-
5. Re: Getting Commits/Rollbacks stats from TxInterceptor
sannegrinovero Oct 24, 2011 3:53 AM (in response to renzos)Hi Renzo,
I hoped it was enough to put "import org.infinispan.test.TestingUtil.getCacheObjectName;" but if infinispan-core doesn't contain it... Do you know where I can download that library from?
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<version>${infinispan.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
-
6. Re: Getting Commits/Rollbacks stats from TxInterceptor
renzos Oct 24, 2011 4:06 AM (in response to sannegrinovero)<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<version>${infinispan.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Thanks but I do not use Maven
-
7. Re: Getting Commits/Rollbacks stats from TxInterceptor
sannegrinovero Oct 24, 2011 4:14 AM (in response to renzos)It's just a way to identify the jar;
you can download it manually from the Maven repository:
select on the version you need, in the "Download" column (right most) download test.jar
-
8. Re: Getting Commits/Rollbacks stats from TxInterceptor
renzos Oct 24, 2011 5:17 AM (in response to sannegrinovero)Thanks a lot, downloaded, imported but I can't manage it to work, the error I get is as follows:
javax.management.InstanceNotFoundException: Node:type=Cache,manager="DefaultCacheManager",name="manager",component=cache
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:662)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:638)
at infinispantest.RunnableImpl.run(RunnableImpl.java:107)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
-
9. Re: Getting Commits/Rollbacks stats from TxInterceptor
sannegrinovero Oct 24, 2011 5:24 AM (in response to renzos)Did you enable JMX and transactions on the Infinispan configuration?
http://docs.jboss.org/infinispan/4.2/apidocs/config.html#ce_global_globalJmxStatistics
-
10. Re: Getting Commits/Rollbacks stats from TxInterceptor
renzos Oct 24, 2011 5:30 AM (in response to sannegrinovero)Sure, transactions already worked before, what I'm trying ti do is getting stats on the number of commits. Here my config file:
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:4.2 http://www.infinispan.org/schemas/infinispan-config-4.2.xsd"
xmlns="urn:infinispan:config:4.2">
<global> <!--contains System wide local settings-->
<globalJmxStatistics enabled="true" />
<transport clusterName="infinispan-cluster" transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport">
<properties>
<property name="configurationFile" value="jgroups-udp.xml" />
</properties>
</transport>
</global>
<default> <!--refers to configuration which is used by all Infinispan caches-->
<deadlockDetection enabled="false"/>
<transaction
transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
syncRollbackPhase="false"
syncCommitPhase="false"
useEagerLocking="false"/>
<locking isolationLevel="REPEATABLE_READ"
writeSkewCheck="false"
concurrencyLevel="500"
useLockStriping="false"
lockAcquisitionTimeout="100" />
<clustering mode="replication">
<sync/>
<stateRetrieval fetchInMemoryState="false"/> <!--updates the cache state on the current node (REPLICATION only) -->
</clustering>
</default>
</infinispan>