[
https://issues.apache.org/jira/browse/PIVOT-747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040716#comment-13040716
]
Andrei Pozolotin commented on PIVOT-747:
----------------------------------------
@Greg & @Noel:
guys, in case you still thik this is "minor":
I have a use case when under jnlp startup pivot blows up on the same assert,
because there is a different "main" under sun plugin2 in browser, called
"javawsApplicationMain"
and I can not even rename the thread, because it happens too early;
##################################
stack trace:
java.lang.IllegalStateException: this method can only be called from the AWT
event dispatch thread; javawsApplicationMain
at
org.apache.pivot.wtk.Container.assertEventDispatchThread(Container.java:853)
at org.apache.pivot.wtk.WTKListenerList.add(WTKListenerList.java:36)
at
org.apache.pivot.wtk.skin.ComponentSkin.install(ComponentSkin.java:96)
at
org.apache.pivot.wtk.skin.ContainerSkin.install(ContainerSkin.java:129)
at org.apache.pivot.wtk.skin.DisplaySkin.install(DisplaySkin.java:41)
at org.apache.pivot.wtk.Component.setSkin(Component.java:749)
at org.apache.pivot.wtk.Display.<init>(Display.java:31)
at
org.apache.pivot.wtk.ApplicationContext$DisplayHost.<init>(ApplicationContext.java:77)
at
org.apache.pivot.wtk.DesktopApplicationContext$DesktopDisplayHost.<init>(DesktopApplicationContext.java:90)
at
org.apache.pivot.wtk.DesktopApplicationContext.main(DesktopApplicationContext.java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.javaws.Launcher.executeApplication(Launcher.java:1804)
at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1750)
at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1512)
at com.sun.javaws.Launcher.run(Launcher.java:130)
at java.lang.Thread.run(Thread.java:662)
##################################
modified assert that prints thread name:
public static final void assertEventDispatchThread() {
/* Currently, application startup happens on the main thread, so we
need to allow
* that thread to modify WTK state.
*/
if (!java.awt.EventQueue.isDispatchThread()
&& !Thread.currentThread().getName().equals("main")) {
throw new IllegalStateException("this method can only be called
from the AWT event dispatch thread; " + Thread.currentThread().getName());
}
}
##################################
and the test app - does nothing wrong, right? :-)
##################################
public class AppXXX implements Application {
protected final Logger log = LoggerFactory.getLogger(getClass());
public AppXXX() {
log.info("init");
}
//
@Override
public synchronized void startup(Display display,
org.apache.pivot.collections.Map<String, String>
properties) {
log.debug("### pivot startup");
}
@Override
public synchronized boolean shutdown(final boolean isShutdownOptional) {
log.debug("### pivot shutdown; isOptional : {};",
isShutdownOptional);
return true;
}
//
@Override
public void suspend() throws Exception {
// not used
}
@Override
public void resume() throws Exception {
// not used
}
}
##################################
> 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
>
>
> 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