Skip to main content



      Home
Home » Eclipse Projects » Memory Analyzer » OQL for thread locals (matching locals to threads)
OQL for thread locals (matching locals to threads) [message #986923] Thu, 22 November 2012 06:35 Go to next message
Eclipse UserFriend
I've been trying to figure out whether it is possible to create some OQL which will return a thread name and specific fields of an object that exists in a stack frame on that thread.

The object in question is a Tomcat request. As far as I can see its only link to the thread is via a Java Local - i.e. there are no named object attributes that contain a reference in either direction that I can use to link the two in OQL.

I can do it manually in the GUI one thread at a time, but I want to speed things up by using a query to do all threads.

So far I've managed to find some OQL to return all objects referenced by the thread, but I can't figure out how to also get the thread name in the results. My trial and error attempts just produced syntax errors. I'll also need to refer to individual fields in the request rather than just returning the whole object.

select distinct * from objects (SELECT objects outbounds(thread) FROM INSTANCEOF java.lang.Thread thread)

Thanks in advance.

Andy Carlson
Re: OQL for thread locals (matching locals to threads) [message #987293 is a reply to message #986923] Sun, 25 November 2012 13:52 Go to previous messageGo to next message
Eclipse UserFriend
The most flexible way would be to write a Request Resolver extension. See also Request Resolver extension from the help documentation.

However this seems the sort of thing that OQL could do, but it is harder than I thought.
SELECT toString(thread),thread from INSTANCEOF java.lang.Thread thread

shows the name, but it is harder to extract the thread locals. Ideally we would use a sub-select, but the OQL grammar allows the select item to be a path expression or env var expression and not a sub-select directly.
You can have a sub-select (in parentheses) as an argument to a function allowing something like
SELECT toString(thread), toString((SELECT outbounds(thread) FROM OBJECTS ${thread} )) FROM INSTANCEOF java.lang.Thread thread 

but that isn't quite right. It also seems hard to do an operation on a sub-select result.

Perhaps the grammar should be relaxed to allow select items with sub-selects or operations on sub-selects results.
Re: OQL for thread locals (matching locals to threads) [message #988579 is a reply to message #987293] Fri, 30 November 2012 10:16 Go to previous message
Eclipse UserFriend
Thanks Andrew - I'll check out the extension stuff, but yes it did seem like a job for OQL to me.
Previous Topic:Skip subtasks when generating MAT reports
Next Topic:uptime
Goto Forum:
  


Current Time: Wed Apr 30 03:26:37 EDT 2025

Powered by FUDForum. Page generated in 0.04114 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top