This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234615

Summary: Run things on main thread
Product: platform Reporter: SirIntellegence
Component: -- Other --Assignee: Jaroslav Tulach <jtulach>
Status: RESOLVED INVALID    
Severity: normal CC: anebuzelsky
Priority: P3    
Version: 7.3.1   
Hardware: Macintosh   
OS: Mac OS X   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Suggested main thread invoke code
Suggested main thread invoke code V2
Suggested main thread invoke code V3
Suggested main thread invoke code V4
Suggested main thread invoke code V5

Description SirIntellegence 2013-08-19 21:54:54 UTC
Hello, I have recently noticed that with some mac native things, you are required to run some things on the main thread, so I was wondering if you could add the ability to Queue Runnables on the main thread while it is waiting for the platform to finish running.
Comment 1 Antonin Nebuzelsky 2013-08-22 15:32:13 UTC
Jarda, what is your take on this question?
Comment 2 Jaroslav Tulach 2013-08-23 10:12:04 UTC
Why not, but you need to show us the code. Attach your suggested patch and reopen.
Comment 3 SirIntellegence 2013-10-15 21:17:30 UTC
Created attachment 141117 [details]
Suggested main thread invoke code

I was thinking of something like this, adding MainThreadRunner.runDeamon() to the end of MainImpl.main
Would that work?
I would test it, but I don't know where the host project is to build Netbeans XD
Comment 4 SirIntellegence 2013-10-15 21:24:47 UTC
Created attachment 141118 [details]
Suggested main thread invoke code V2

This one might be safer without the nested synchronized blocks
Comment 5 SirIntellegence 2013-10-15 21:28:28 UTC
Created attachment 141119 [details]
Suggested main thread invoke code V3

This one handles InvokeAndWait exeptions better
Comment 6 SirIntellegence 2013-10-19 00:05:22 UTC
Created attachment 141282 [details]
Suggested main thread invoke code V4

Fixed the logical impossibility of actually doing an invoke operation due to not notifying the main thread....
Comment 7 SirIntellegence 2013-10-19 02:35:53 UTC
Created attachment 141286 [details]
Suggested main thread invoke code V5

Then add a dependency on Bootstrap for Execution API, and append this to the ManImpl.main(String[]) method:
ThreadRunner.runDeamon(ThreadRunner.getDefault());
Comment 8 SirIntellegence 2013-10-29 00:54:25 UTC
I have noticed that it doesn't like being in Execution API, so I put it in lookup, and that seems to work
Comment 9 Jaroslav Tulach 2013-12-18 14:41:49 UTC
Version five does not look like a diff that could be applied. Closing.