Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should be able to query all collections or single one with Object Query Language (OQL) in <a href="http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html" rel="nofollow noreferrer">jhat</a>.</p> <p>You can't necessarily invoke arbitrary methods but you can write some complicated queries using the available functions. </p> <p>A. Sundararajan has some interesting blog posts on the subject that showcase what you can do. See <a href="http://blogs.oracle.com/sundararajan/entry/querying_java_heap_with_oql" rel="nofollow noreferrer">here</a> and <a href="http://blogs.oracle.com/sundararajan/entry/permanent_generation_analysis_with_oql" rel="nofollow noreferrer">here</a>.</p> <p>For instance, you can find all instances of <code>java.util.HashMap</code> that have a key <em>test</em> with the following query:</p> <pre><code>select s from java.util.HashMap s where contains(s.table, function(it) { if (it &amp;&amp; it.key &amp;&amp; it.key.value &amp;&amp; it.key.value.toString() == 'test') { return true; } return false; }) </code></pre> <p>This should find the same key in a <code>java.util.concurrent.ConcurrentHashMap</code>:</p> <pre><code>select s from java.util.concurrent.ConcurrentHashMap s where contains(s.segments, function(it) { if (!it || !it.table) { return false; } var i, e; for (i=0; i &lt; it.table.length; i = i + 1) { e = it.table[i]; if (e) { return e.key &amp;&amp; e.key.value &amp;&amp; e.key.value.toString() == 'test'; } } return false; }) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload