[infinispan-dev] update page on custom interceptors
Galder Zamarreno
galder at redhat.com
Fri Feb 26 03:57:57 EST 2010
Good stuff Mircea!! :)
As a FYI, a similar technique is used in AS to track unclosed connections:
https://anonsvn.jboss.org/repos/jbossas/trunk/connector/src/main/java/org/jboss/resource/adapter/jdbc/WrappedConnection.java
On Wed, 24 Feb 2010 17:17:47 +0100, Mircea Markus
<mircea.markus at jboss.com> wrote:
> Thanks!
> I've been using testNG listener to notify me whenever a thread finishes
> processing a test. Whenever a cache is created, I create a stack trace
> and determine which method performed the call:
> private static String extractMethodName() {
> StackTraceElement[] stack = Thread.currentThread().getStackTrace();
> if (stack.length == 0) return null;
> for (int i = stack.length - 1; i > 0; i--)
> {
> StackTraceElement e = stack[i];
> String className = e.getClassName();
> if ((className.indexOf("org.infinispan") != -1) &&
> className.indexOf("org.infinispan.test") < 0)
> return e.toString();
> }
> return null;
> }
> On 24 Feb 2010, at 18:12, Vladimir Blagojevic wrote:
>
>> Very cool! You are even reporting the line number! How did you do this
>> CacheManager tracking?
>> On 2010-02-24, at 11:06 AM, Mircea Markus wrote:
>>
>>> Hi,
>>>
>>> I've added a sanity check to verify weather all the CacheManagers
>>> created by a test are being shutdown within the same test[1].
>>> The cool part is that if a CM is not being closed, the fwk will report
>>> you where the unclosed CacheManager was created (java file and line,
>>> see bellow), so that you don't have to spend too much time looking
>>> into code ;)
>>> E.g.
>>>
>>> [pool-2-thread-7] Test
>>> testTxChangesOnAtomicMap(org.infinispan.atomic.AtomicMapFunctionalTest)
>>> succeeded.
>>> Test suite progress: tests succeeded: 179, failed: 1, skipped: 0.
>>> [pool-2-thread-7] Test
>>> testTxChangesOnAtomicMapNoLocks(org.infinispan.atomic.AtomicMapFunctionalTest)
>>> succeeded.
>>> Test suite progress: tests succeeded: 180, failed: 1, skipped: 0.
>>>
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>>> !!!!!! (pool-2-thread-7) Exiting because
>>> atomic.AtomicMapFunctionalTest has NOT shut down all the cache
>>> managers it has started !!!!!!!
>>> !!!!!! (pool-2-thread-7) The still-running cacheManager was created
>>> here:
>>> org.infinispan.atomic.AtomicMapFunctionalTest.setUp(AtomicMapFunctionalTest.java:33)
>>> !!!!!!!
>>> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>>>
>>> Cheers,
>>> Mircea
>>>
>>> [1]https://jira.jboss.org/jira/browse/ISPN-314
>>> _______________________________________________
>>> infinispan-dev mailing list
>>> infinispan-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache
More information about the infinispan-dev
mailing list