Home > javafx > Java Download Service Listener

Java Download Service Listener


Bookmark and Share

One of the previous post [Applet Startup Time] provided a way to measure start-up time of JavaFX Applets. Many responded with requested information (Thanks a lot!). One of the main concern raised was high start-up time for “Without JavaFX Runtime”. This is high because it includes time taken to download and install JavaFX Runtime.

Unfortunately there was no way to notify the user about exact progress of this. Hence user will not be able to differentiate between download and install of “JavaFX Runtime” and “JavaFX Application”.

Recent JavaFX Update 1.2.3 reduced the download size and start-up time. You can notice this change by trying out the start-up time measurement applet again.. But still it doesn’t provide a way to exactly notify the start-up progress. We can only specify a custom splash-screen as specified here.

And then we have Java Update 1.6.0_18 Not sure how many of you noticed this feature – Download Service Listener It allows you to provide a Custom Progress UI using AWT/Swing/Java2D APIs. It has callback methods which will provide information related to download and validation of resources. Please refer to Download Service Listener Example for more information. Refer to ProgressListener.java and ProgressView.java for implementation used in this sample.


To launch click on above image or

Now we can implement custom progress listener with actual values. We can use the same approach for JavaFX applications as well. There is minor issue in using this feature with JavaFX Applet deployed using dtfx.js. This script is not updated to utilize this feature. So for now we need to explicitly hide the default splash screen by invoking JavaScript method hideOverlay as shown in ProgressListenerFX.html

Reference:

Hmm.. thatz a long post with lots of information.. But I think its very useful.. As usual, please try it out and let me know feedback..

Advertisements
Categories: javafx Tags: , , ,
  1. February 10, 2010 at 11:21 PM

    Rakesh,

    Java Plug-in 1.6.0_18
    Using JRE version 1.6.0_18-b07 Java HotSpot(TM) Client VM
    MS Windows XP Professional version 2002 SP Pack 3
    Pentium(R)4 HT 3.4 GHz

    First time launch:
    4.264 seconds

    Second time launch Reload:
    .371 seconds

    Third time launch Reload:
    .378 seconds
    I forgot to copy previous console outputs but here it is for the third load:
    HTML_TIME : 1265822927001
    APPLET_TIME: 1265822931265
    LOAD_TIME : 4264.0 Milli-Seconds
    HTML_TIME : 1265822958347
    APPLET_TIME: 1265822958718
    LOAD_TIME : 371.0 Milli-Seconds
    HTML_TIME : 1265822976434
    APPLET_TIME: 1265822976812
    LOAD_TIME : 378.0 Milli-Seconds

    Fourth time: Wow!

    HTML_TIME : 1265822927001
    APPLET_TIME: 1265822931265
    LOAD_TIME : 4264.0 Milli-Seconds
    HTML_TIME : 1265822958347
    APPLET_TIME: 1265822958718
    LOAD_TIME : 371.0 Milli-Seconds
    HTML_TIME : 1265822976434
    APPLET_TIME: 1265822976812
    LOAD_TIME : 378.0 Milli-Seconds
    HTML_TIME : 1265824105242
    APPLET_TIME: 1265824105484
    LOAD_TIME : 242.0 Milli-Seconds

    Next, I plan to do it on a Vista machine

    I have had other application running of coarse while running the applet, so the times I’m sure should be better.

    Yep, pretty impressive! You guys are heroes… Applets making a comeback (finally).

    How do you clear the cache again?

    -Carl

    • February 11, 2010 at 9:26 AM

      @Carl Great! May be I must collect these new data and compare with the previous startup data.. 🙂
      Latest JRE installers downloads and saves JavaFX Runtime in “system” cache.. You can remove
      both user and system cache entry using below commands..

      javaws -system -uninstall
      javaws -uninstall

  1. February 11, 2010 at 11:23 AM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: