Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353341

Summary: Proposed patch to add IHeapObjectArgument to ThreadOverviewQuery
Product: [Tools] MAT Reporter: Kevin Grigorenko <kevin.grigorenko>
Component: CoreAssignee: Project Inbox <mat.core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch to add IHeapObjectArgument to ThreadOverviewQuery
none
Patch to add IHeapObjectArgument to ThreadOverviewQuery V2 none

Description Kevin Grigorenko CLA 2011-07-28 12:03:48 EDT
Created attachment 200541 [details]
Patch to add IHeapObjectArgument to ThreadOverviewQuery

I wanted to build a query which returned a subset of the ThreadOverviewQuery; for example:

SnapshotQuery threads = SnapshotQuery.lookup("thread_overview", snapshot);
threads.setArgument("objects", hungThreadObjectIds);
return threads.execute(listener);

However, the ThreadOverviewQuery does not have an IHeapObjectArgument argument. I ended up using thread_stacks, but I would have liked the data in thread_overview. Attached is a proposed patch to add this support -- it blindly takes input object IDs as threads, and if there were none, falls back to the old behavior of finding all Thread objects.

One downside is that this changes the behavior of Thread Overview because the input dialog pops up now. I think this is okay since all the other thread queries do this. If this is an issue, one solution would be to add a "default" parameter to @Argument, so that the user doesn't think that the class name of threads must be specified:

@Argument(isMandatory = false, flag = Argument.UNFLAGGED, default = "java.lang.Thread")
public IHeapObjectArgument objects;
Comment 1 Kevin Grigorenko CLA 2011-07-28 12:08:53 EDT
Created attachment 200542 [details]
Patch to add IHeapObjectArgument to ThreadOverviewQuery V2

Fixed NPE
Comment 2 Andrew Johnson CLA 2011-10-21 05:42:00 EDT
Fixed by 353517.

*** This bug has been marked as a duplicate of bug 353517 ***