[
https://issues.apache.org/jira/browse/PIVOT-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041149#comment-13041149
]
Andrei Pozolotin commented on PIVOT-747:
----------------------------------------
@ Noel:
please take a look on patch_2011-05-29_assert-runner.patch ;
benefits:
1) flexible / insertable / switchable;
2) does not take much space in Container.java;
3) much less perfomance hit when not active;
4) allows not to blow up but reports violations instead;
5) preserves original intent to inforce EDT contract;
this is how I use it:
####################################
public class App extends HostServiceProvider implements Application {
private final Runnable assertRunner = new Runnable() {
@Override
public void run() {
if (EventQueue.isDispatchThread()) {
return;
}
String name = Thread.currentThread().getName();
if (name.equals("main")) {
return;
}
if (name.equals("javawsApplicationMain")) {
return;
}
if (name.startsWith("AWT-EventQueue-")) {
return;
}
Exception e = new Exception("NON EDT THREAD : " + name);
log.error("", e);
}
};
@Override
public synchronized void startup(Display display,
org.apache.pivot.collections.Map<String, String>
properties) {
Container.setAssertRunner(assertRunner);
@Override
public synchronized boolean shutdown(final boolean isShutdownOptional) {
Container.setAssertRunner(null);
####################################
> pivot & blocking edt
> --------------------
>
> Key: PIVOT-747
> URL: https://issues.apache.org/jira/browse/PIVOT-747
> Project: Pivot
> Issue Type: Improvement
> Components: wtk
> Affects Versions: 2.0
> Reporter: Andrei Pozolotin
> Assignee: Noel Grandin
> Priority: Minor
> Fix For: 2.0.1
>
> Attachments: Container.java, patch-001-exit.patch,
> patch_2011-05-27_edt-name.patch, patch_2011-05-29_assert-runner.patch
>
>
> Greg, hello;
> in this thread:
> http://mail-archives.apache.org/mod_mbox/pivot-user/201001.mbox/%[email protected]%3E
> your final word is:
> "Sorry, it is not possible"
> but I know that you know that it is possible :-)
> the reason I need this is same as Martin here:
> http://netbeans.org/bugzilla/show_bug.cgi?id=90590
> namely: do some cleanup after shutdown was requested and confirmed:
> org.apache.pivot.wtk.Application
> public boolean shutdown(boolean optional) throws Exception;
> since you call shutdown(boolean optional) from EDT I need to block it, using
> this approach:
> http://bugs.sun.com/view_bug.do?bug_id=6424157
> wich "almost works", except you have this check everywhere:
> Container.assertEventDispatchThread();
> which fails, as described above:
> http://bugs.sun.com/view_bug.do?bug_id=6424157
> due to EventQueue.isDispatchThread() failing on the "T1 vs T1*" distinction
> my request is this:
> do you think you could make
> Container.assertEventDispatchThread();
> less pedantic, and allow both "current and past/next" EDT threads to pass
> which are created during EventQueue push() / pop()
> thanks!
> Andrei
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira