Results 1 to 7 of 7
  1. #1
    sunny5055 is offline Member
    Join Date
    Feb 2013
    Posts
    4
    Rep Power
    0

    Default How to prevent applet from InterruptedException when the page is refreshed

    Hi Guys,

    Is there a way we can prevent an applet from being interrupted when the user navigates away or refreshes the page ?

    I am getting the below error whenever the user invokes the applet and navigates away or refreshes the frame.

    My requirement is the make the applet complete it action before it is destroyed or stopped.
    I am not sure if this problem is due to new java life cycle. I tried setting the legacy_lifetime=true and I got the same error or java.io.IOException when legacy_lifecycle=true

    java.lang.NullPointerException
    at java.awt.EventQueue.isDispatchThread(EventQueue.ja va:1005)
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter .runOnEDT(Unknown Source)
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter .start(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:780)
    Ignored exception: java.lang.NullPointerException

    java.lang.InterruptedException
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:196)
    at sun.plugin2.message.Queue.waitForMessage(Unknown Source)
    at sun.plugin2.message.Pipe$2.run(Unknown Source)
    at com.sun.deploy.util.Waiter$1.wait(Unknown Source)
    at com.sun.deploy.util.Waiter.runAndWait(Unknown Source)
    at sun.plugin2.message.Pipe.receive(Unknown Source)
    at sun.plugin2.main.client.MessagePassingExecutionCon text.doCookieOp(Unknown Source)
    at sun.plugin2.main.client.MessagePassingExecutionCon text.getCookie(Unknown Source)
    at sun.plugin2.main.client.PluginCookieSelector.getCo okieFromBrowser(Unknown Source)
    at com.sun.deploy.net.cookie.DeployCookieSelector.get CookieInfo(Unknown Source)
    at com.sun.deploy.net.cookie.DeployCookieSelector.get (Unknown Source)
    at sun.net.http://www.protocol.http.HttpURLConn...ion.java:1192)
    at sun.net.http://www.protocol.http.HttpURLConn...tion.java:624)
    at sun.net.http://www.protocol.http.HttpURLConn...ion.java:1332)
    at com.sun.deploy.net.HttpUtils.followRedirects(Unkno wn Source)
    at com.sun.deploy.net.BasicHttpRequest.doRequest(Unkn own Source)
    at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX (Unknown Source)
    at com.sun.deploy.cache.ResourceProviderImpl.checkUpd ateAvailable(Unknown Source)
    at com.sun.deploy.cache.ResourceProviderImpl.isUpdate Available(Unknown Source)
    at com.sun.deploy.cache.DeployCacheHandler.get(Unknow n Source)
    at sun.net.http://www.protocol.http.HttpURLConn...tion.java:888)
    at sun.net.http://www.protocol.http.HttpURLConn...tion.java:861)
    at sun.net.http://www.protocol.http.HttpURLConn...ion.java:1311)
    at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Un known Source)
    at sun.plugin.PluginURLJarFileCallBack.access$000(Unk nown Source)
    at sun.plugin.PluginURLJarFileCallBack$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Access Controller.java:280)
    at sun.plugin.PluginURLJarFileCallBack.retrieve(Unkno wn Source)
    at sun.net.http://www.protocol.jar.URLJarFile.r...File.java:217)
    at sun.net.http://www.protocol.jar.URLJarFile.g...rFile.java:83)
    at sun.net.http://www.protocol.jar.JarFileFacto...ctory.java:95)
    at sun.net.http://www.protocol.jar.JarURLConnec...tion.java:135)
    at sun.net.http://www.protocol.jar.JarURLConnec...tion.java:102)
    at com.sun.deploy.security.DeployURLClassPath$JarLoad er.getJarFile(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath$JarLoad er.access$1000(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath$JarLoad er$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Access Controller.java:280)
    at com.sun.deploy.security.DeployURLClassPath$JarLoad er.ensureOpen(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath$JarLoad er.<init>(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath$3.run(U nknown Source)
    at java.security.AccessController.doPrivileged(Access Controller.java:280)
    at com.sun.deploy.security.DeployURLClassPath.getLoad er(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath.getLoad er(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath.getReso urce(Unknown Source)
    at com.sun.deploy.security.DeployURLClassPath.getReso urce(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknow n Source)
    at java.security.AccessController.doPrivileged(Access Controller.java:314)
    at sun.plugin2.applet.Plugin2ClassLoader.findClassHel per(Unknown Source)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Un known Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(U nknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Un known Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(U nknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Un known Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Un known Source)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:6 89)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unk nown Source)
    at sun.plugin2.applet.Plugin2Manager.initAppletAdapte r(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:780)

    Thanks
    Sunny

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: How to prevent applet from InterruptedException when the page is refreshed

    Life cycle of an applet.
    If there are things that need to be tidied up then you can override stop() and handle those actions there.
    You cannot prevent the applet from being stopped and then destroyed, because the applet is tied to the page. Anything that causes the page to be changed (and this includes reloading) will cause the applet to be unloaded.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    sunny5055 is offline Member
    Join Date
    Feb 2013
    Posts
    4
    Rep Power
    0

    Default Re: How to prevent applet from InterruptedException when the page is refreshed

    Quote Originally Posted by Tolls View Post
    Life cycle of an applet.
    If there are things that need to be tidied up then you can override stop() and handle those actions there.
    You cannot prevent the applet from being stopped and then destroyed, because the applet is tied to the page. Anything that causes the page to be changed (and this includes reloading) will cause the applet to be unloaded.

    Thanks for the reply. I already tried overridding the destroy and stop methods. But these methods are not called as i see from the java console debug logs.
    So it never reaches the override method.

    Then applet thread is interrupted before the applet stop is invoked.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: How to prevent applet from InterruptedException when the page is refreshed

    Have you still got the legacy_lifecycle flag set?
    If so then remove that.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    sunny5055 is offline Member
    Join Date
    Feb 2013
    Posts
    4
    Rep Power
    0

    Default Re: How to prevent applet from InterruptedException when the page is refreshed

    Yes i have removed the flag since it didn't solve the issue. Currently my applet gets interrupted once the frame is unloaded.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default Re: How to prevent applet from InterruptedException when the page is refreshed

    And it's a JRE6 it's running on?

    If so, then I'm not sure what's happening.
    stop() should be called.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    sunny5055 is offline Member
    Join Date
    Feb 2013
    Posts
    4
    Rep Power
    0

    Default Re: How to prevent applet from InterruptedException when the page is refreshed

    Thanks for reply. Yes running on 1.6 u32.

Similar Threads

  1. Replies: 4
    Last Post: 08-17-2012, 10:38 PM
  2. JLabel is not refreshed from withing ActionPerformed
    By mavaforumsm in forum AWT / Swing
    Replies: 2
    Last Post: 05-25-2010, 05:32 PM
  3. InterruptedException and Locks
    By JavaJuJitZu in forum Threads and Synchronization
    Replies: 3
    Last Post: 02-19-2010, 02:47 AM
  4. Replies: 2
    Last Post: 05-28-2009, 05:09 PM
  5. Replies: 1
    Last Post: 07-31-2007, 05:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •