Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » OQL nested list flattening and filtering(Trying to find deeply nested in sublists based on object properties)
OQL nested list flattening and filtering [message #1736804] Sat, 02 July 2016 00:10
ken marx is currently offline ken marxFriend
Messages: 3
Registered: June 2016
Junior Member
I'm using OQL to try and find suspect null-referent WeakReferences being held in a higher level object. These references are deeply nested in more than one level of HashMap/ConcurrentHashMap entries. Eventually, I think my query will have something like:
... where ((c != 0) AND 
		(${snapshot}.getObject(${snapshot}.mapAddressToId(c)).referent = null))) != null

And the nested lists and member access of this mess de-references something like this:

For now, I'm just trying some proof of concept queries and will add the tortuous OQL de-referencing for nesting ofthe real WeakReference objects later. What I'm seeing, though, is that while the filtering does seem to work to a degree, it's not perfect. About half of the results satisfy the where predicate I'm trying, but many do not.

Here's the glorious query to date (that I gleaned from [message #1199096]:
SELECT objects p.table.@referenceArray FROM OBJECTS 
	( SELECT DISTINCT OBJECTS imm.identityMaps.segments.@referenceArray 
	FROM org.eclipse.persistence.internal.identitymaps.IdentityMapManager imm  ) p 
where ((select distinct c from OBJECTS ${p}.table.@referenceArray c 
              where ((c != 0) AND 
                 (${snapshot}.getObject(${snapshot}.mapAddressToId(c)).hash = 135258062))) != null)

So, the table is an array of ConcurrentHashMap$HashEntry's. Each of those - named by c in the query - has attribute named "hash" and I'm just trying to see if I can filter for those that have a hash value of 135258062. (Again, this isn't my eventual goal, but just a test to see if I can understand how OQL and filtering will work.)

Without that predicate on the hash value, I get thousands of result objects; With it on, I get 63 or so, which is promising. But while some do have a hash value that matches 135258062, some don't. E.g.,

Type|Name |Value
ref |next |null
ref |value|org.eclipse.persistence.internal.identitymaps.HardCacheWeakIdentityMap$ReferenceCacheKey @ 0x654f98c08
int |hash |49907301
ref |key |org.eclipse.persistence.internal.identitymaps.CacheId @ 0x655e2f400

So, I guess I have two questions:

1. Is there a simpler way to query down into the guts of nested lists of objects as I'm trying to do?
2. What am I doing wrong in my where clause such that it only mostly works?

I should maybe mention that this is in Mars.2 Release (4.5.2), MAT I tried MAT 1.6 but couldn't get any object rows at all (see - mat 1.6 oql object de-reference problem - yields blank row values [message #1736513]).

Thanks for any assistance!

[Updated on: Sat, 02 July 2016 00:13]

Report message to a moderator

Previous Topic:Memory Analyzer 1.6.0 Released
Next Topic:MAT 1.6 OQL object de-reference problem - yields blank row values
Goto Forum:

Current Time: Mon Nov 12 18:36:07 GMT 2018

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

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

Back to the top