United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6834128 should not download applet JNLP file on EventDispatchThread
6834128 : should not download applet JNLP file on EventDispatchThread

Details
Type:
Bug
Submit Date:
2009-04-24
Status:
Closed
Updated Date:
2010-11-03
Project Name:
JDK
Resolved Date:
2009-11-20
Component:
deploy
OS:
generic
Sub-Component:
plugin
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u14
Fixed Versions:
6u18

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
browser window is not responsive during initial download of applet JNLP file; this is very noticeable especially when the jnlp file download is very slow due to network issues.

Problem is the initial download of JNLP file happens in EDT:

"AWT-EventQueue-3" prio=4 tid=0x0314ac00 nid=0xbe4 runnable [0x03acf000..0x03acfb60]
  java.lang.Thread.State: RUNNABLE
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(Unknown Source)
   - locked <0x229bba00> (a java.net.SocksSocketImpl)
   at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
   at java.net.PlainSocketImpl.connect(Unknown Source)
   at java.net.SocksSocketImpl.connect(Unknown Source)
   at java.net.Socket.connect(Unknown Source)
   at sun.net.NetworkClient.doConnect(Unknown Source)
   at sun.net.www.http.HttpClient.openServer(Unknown Source)
   at sun.net.www.http.HttpClient.openServer(Unknown Source)
   - locked <0x229bb550> (a sun.net.www.http.HttpClient)
   at sun.net.www.http.HttpClient.<init>(Unknown Source)
   at sun.net.www.http.HttpClient.New(Unknown Source)
   at sun.net.www.http.HttpClient.New(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
   - locked <0x229b7e80> (a sun.net.www.protocol.http.HttpURLConnection)
   at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)
   at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
   at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCachedFile(Unknown Source)
   at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
   at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
   at sun.plugin2.applet.JNLP2Manager.initialize(JNLP2Manager.java:311)
   at sun.plugin2.main.client.PluginMain$StartAppletRunner.run(PluginMain.java:908)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)

Subsequent JAR download happens in a separate applet thread, so it's okay:

"thread applet-SwingSet2Applet-1" prio=4 tid=0x02ad7800 nid=0x8b8 runnable [0x03f3f000..0x03f3fc60]
  java.lang.Thread.State: RUNNABLE
   at java.net.SocketInputStream.socketRead0(Native Method)
   at java.net.SocketInputStream.read(Unknown Source)
   at java.io.BufferedInputStream.fill(Unknown Source)
   at java.io.BufferedInputStream.read1(Unknown Source)
   at java.io.BufferedInputStream.read(Unknown Source)
   - locked <0x229b6ee0> (a java.io.BufferedInputStream)
   at sun.net.www.MeteredStream.read(Unknown Source)
   - locked <0x229d36f0> (a sun.net.www.http.KeepAliveStream)
   at java.io.FilterInputStream.read(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
   at java.io.BufferedInputStream.read1(Unknown Source)
   at java.io.BufferedInputStream.read(Unknown Source)
   - locked <0x229e46c8> (a java.io.BufferedInputStream)
   at java.io.BufferedInputStream.fill(Unknown Source)
   at java.io.BufferedInputStream.read1(Unknown Source)
   at java.io.BufferedInputStream.read(Unknown Source)
   - locked <0x229eefb8> (a java.io.BufferedInputStream)
   at java.io.FilterInputStream.read(Unknown Source)
   at java.io.PushbackInputStream.read(Unknown Source)
   at java.util.zip.InflaterInputStream.fill(Unknown Source)
   at java.util.zip.InflaterInputStream.read(Unknown Source)
   at java.util.zip.ZipInputStream.read(Unknown Source)
   at com.sun.deploy.net.HttpDownloadHelper.decompressWrite(Unknown Source)
   at com.sun.deploy.net.HttpDownloadHelper.download(Unknown Source)
   at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Unknown Source)
   at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
   at com.sun.javaws.LaunchDownload.downloadJarFiles(Unknown Source)
   at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
   at sun.plugin2.applet.JNLP2Manager.downloadResources(JNLP2Manager.java:1140)
   at sun.plugin2.applet.JNLP2Manager.prepareLaunchFile(JNLP2Manager.java:734)
   at sun.plugin2.applet.JNLP2Manager.loadJarFiles(JNLP2Manager.java:498)
   at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1393)
   at java.lang.Thread.run(Unknown Source)

                                    

Comments
EVALUATION

A fix would involve checking whether the current thread which is downloading the JNLP file is an Event Dispatch Thread. If it is, start a new thread to download the JNLP file and wait for the thread to finish downloading the file.
                                     
2009-05-14
EVALUATION

JNLP2Manager initialization is done on the event dispatcher thread is because we need create the embedded frame in the right AppContext. The networking on the EDT happens only when the jnlp file itself need update (or redirection). For better performance, we need refactor out only necessary code to run on EDT.
                                     
2009-05-14



Hardware and Software, Engineered to Work Together