0 Replies Latest reply: Jan 26, 2012 2:00 AM by castorp RSS

    OQL query to find empty maps

    castorp
      Hello,

      I'm trying to find instances of a Map inside a heapdump using VisualVM's "OQL Console".

      But I can't figure out how to access the size (or count) property of a map.

      What I tried was the following:
      select m from java.util.concurrent.ConcurrentHashMap m where m.count == 0
      But that didn't return anythong (although I know that there are empty maps in the heap by looking at the instances itself)

      Then I found another example which used some kind of casting to ensure that m.count would be treated as a number:
      select m from java.util.concurrent.ConcurrentHashMap m where m.count * 1 == 0
      That seemed to returned instances, but when I tried to find the non-empty ones using
      select m from java.util.concurrent.ConcurrentHashMap m where m.count * 1 > 0
      I didn't return anything, and I know (again from looking at the instances) that there are non-empty maps in there.

      I also tried replacing m.count with m.size in all examples, but still no go.

      I'm sure I'm missing something obvious with the OQL syntax, but what?