IE hangs when applet closed - need to use taskman

I am fairly new to java and have been working on an application that interfaces a commercially available webserver with a 8 bit microcontroller. The micro communicates with the webserver via RS-232 but the applet gets the info through ethernet.
My problem is that when the applet is waiting for data using the following code, if the browser is closed(IE) IE hangs and requires using the taskman to terminate the program. If the browser is closed in any other condition it shuts down normally. What can I do to get this process to terminate correctly?
Thanks in advance.
while ( (gtp != null) && (count <= 42) ) {     
      if (gtp.available() > 0){
     in = gtp.receive();
     // store received board disc status bytes
          for (i = 0; i < in.length; i++) {
               if (board[count] != in[i]-48)
                    iMove_loc = count;     
               board[count] = in[i]-48;
               count = count +1;          
}

That's a very tight loop, hogging the CPU all the while. Time for a redesign, to be sure, to get it to be 'notified' when data is available rather than polling like that. Or at least throttle down the polling quite a bit by introducing sleeps.
Also, I hope that loop is in a separate thread from the applet's main thread.
When you shut down IE, the applet's stop/destroy methods will be called - at which point you should 'notify' the code being executed in that loop that it's time to get out.

Similar Messages

  • When do I need to use "void" ?

    When do I need to use "void" ?
    Thanks!!!

    When do I need to use "void" ?whenever you like to use it? although normally when e.g a method does not return a value
    public void sayHello() {
       System.out.println("Hello");
    }

  • ODI Agent - when do i need to use?

    can anybody explain me the perpose of ODI Agent? and when do i need to use Agent?
    Edited by: knidhi on Oct 5, 2009 3:31 PM
    Edited by: knidhi on Oct 5, 2009 4:07 PM

    If I could finesse your answer slightly, hopefully to help (or confuse):
    There are multiple agent types:
    - the Local (No agent): this opens additional threads in the current GUI process. The agent will just run as additional threads in your current process, using the same settings as your GUI environment.
    - a standalone agent: if you start an agent from the commandline using the agent.sh/bat. This will start a "listener agent". It starts up and passively listens for execution requests. When a request is passed to the agent, it includes all the necessary information to connect to the repository etc. All this information is there in the invocation package. (for more information on what is passed look at the documentation for the invocation API or at the ODIInvoke webservice)
    - a scheduler agent: when you start a scheduler agent from the commandline with the agentscheduler.bat/sh file, it will read from the odiparams.sh/bat file the connectivity paramaters for the repository, where it will "look itself up" based on the agent name passed, to find out what scenarios it should be scheduling. This agent may also take requests, just like the standalone agent described above.
    - a task may also be invoved at the opertaing system command level using startscen.bat/sh. This will start a standlone agent for the duration of this execution only, which not listen for other requests, it reads its parameters from the command line (for which sceenario, version and context) and from the odiparams file for the repository connectivity parameters as to where to find the requested scenario and where the execution will be logged.

  • DirectX hangs when a program needs it to be installed

    Hi all,
    I have a problem with installing directx on win 8.1. When a programm needs it it starts the installation but the process (dxsetup.exe) hangs without using any ressources. The same happens when I try to install directx again from the windows website. 
    Any suggestions? 
    Thank you! :-)

    Hi,
    You can search dxdiag.exe in Search charm and run the Diagnostic tool to check the general issue.
    Also, Use
    SFC /Scannow to repair Protected Windows Operating System Files and then try using DirectX End-User Runtime Web Installer.
    Please post the event log via Onedrive and share the link here:
    Kate Li
    TechNet Community Support

  • Applications Hang when selecting / attaching a file using Spotlight

    Hi,
    Having a problem since upgrading to Snow Leopard with applications 'hanging' when trying to attach a file using Spotlight. I can repeatedly cause the failure in Mail and Safari - and probably others as well - but these two applications I use most often and need to attach files to most often.
    When I select "Attach a file", and use Spotlight to find the file to attach, the file dialog box closes and the attachment is apparently made - seconds later the spinning wheel appears and the dock tells me "Application Not Responding."
    Any ideas as to how / why this is happening? Help make it stop!
    Thank you,
    Gordon.

    OK Search box
    Mine is OK so something is screwy..
    In your Finder Prefs > Advanced > When performing a search drop down. Search this Mac seems to be default and the one I have set. Have you got it set to search the current folder or use the previous search instead?
    I'd then pull out the com.apple.finder.plist from your user Library > Preferences to the desktop and let finder make a new one. If all is OK trash the old one.
    Relaunch Finder by holding down the option key while right clicking Finder icon in the dock. Relaunch will be on the bottom of the context menu.
    S.

  • MAC HANGS WHEN I WRITE DVD VIDEO USING TOAST OR IDVD

    DEAR SIR,
    I HAVE A PROBLEM WITH MY SONY DVD .. EVERY TIME I TRY TO WRITE DVD VIDEO MY MAC HANGS WHEN TOAST ROXIO 10 STARTS TO LEAD OUT AFTER ENCODING THE VIDEO .. AND IT HANGS ALSO WITH IDVD AFTER ENCODING THE VIDEO .. AND I MUST RESTART MY MAC ...PLEASE TELL ME HOW TO FIX IT ??
    Model: SONY DVD RW DRU-835A
    Revision: SS02
    Removable Media: Yes
    Detachable Drive: No
    BSD Name: disk2
    Protocol: ATAPI
    Unit Number: 1
    Socket Type: Internal
    Low Power Polling: No
    Mac OS 9 Drivers: No
    Partition Map Type: Unknown
    S.M.A.R.T. status: Not Supported
    THANK YOU FOR YOUR TIME
    TAHA TALAAT
    [email protected]

    This is a user forum.
    Caps is considered yelling, inappropriate, a left over from DOS, too. Oh, and it actually is HARDer to read.

  • URLConnection.getOutputStream() hang when applet displayed a second time

    This is happening on Linux using the 1.31_02 plugin.
    My applet uses a URLConnection object to get information from a servlet. This method is in it's own thread, and is periodically called to keep the display of the applet up to date.
    The second time the applet is displayed (navigate away from the page and then return), the applet hangs in the method URLConnection.getOutputStream().
    Note that this only happens on Linux browsers, it's fine on Windows.
    Is there any way to programatically force a reset on the URL? The only way I have been able to recover is to restart the browser.
    Thanks.

    I am having similar problem with URLConnection.getOutputStream() that hangs in Mozilla 1.2.1 browser when it tries to write to linux server. It never creates this object outputStream = new BufferedWriter( new OutputStreamWriter(connect.getOutputStream())); System.out.println before this line shows but the one after does not show at all. Can you help? I am using Java plug-in 1.3.1_02. I would appreciate any help.

  • Java plugin hangs when communicating to browser scripts (Using JSObject)

    I saw several questions in the forum regarding the Java plug-in 1.3.1, however I would like to post this as separately since I want your attention to this, ASAP.
    The problem is this, when I run Java Swing Applet using IE 5.0 with the Java plug-in 1.3.1 communication from Applet to browser hangs. (This is by using the JSObject shipped with the IE5). I communicate with the browser using Java Script functions calling from the applet to the browser. For example
    win.call("Func_to_call",Value); But the same code is working when compiled and run under Java plug-in and JRE for version 1.3.0.
    Please help. I think the problem may be with the JSObject that I use (May be incompatible with the JRE or plug-in of 1.3.1), can you please suggest a solution or give me a URL to find the latest JSObject for the plug-in 1.3.1.
    Thanks in advance
    Nuuwi

    oops... forgot to say what is this 'win'
    'win' is the windows object taken as
    win = JSObject.getWindow(this); [\code]
    thanx                                                                                                                                                                                                                                                                               

  • "formatting Document" hangs when opening page in GLCS using XP Pro

    I've just installed GoLive CS on a new computer running XP Pro, (4 gigs memory (really 3.5), Core2 Quad processor). My old computer's OS was W2K and it ran GLCS wthout any issues. With the new system, when opening a page from the site folder an "Open Document" window pops up with a message saying "formatting document." This window hangs, it won't close and the progress bar remains empty. It seems to be stuck.  The pop-up doesn't go away until GoLive is closed. This never happened when running under W2K on the old computer, it has only showed up since using XP Pro on the new computer.
    Does anyone have a suggestion on where to start troubleshooting this issue. Obviously, I cannot work on my site until this litte quirk goes away. Your help is most appreciated.
    Carol

    This is additional information I've discovered since posting the original message. It appears that the pop-up is a status window that shows the current task when working on a page. As mentioned in my original message, I never saw this when using the W2K OS, so I'm thinking it must be an XP related thing. How can I turn this off? I've been thru preferences and all the view settings, but have not found the key to getting rid of the status window, short of closing GoLive.
    The attached image shows the pop-up window.
    And thanks to Kate (if I remember correctly), I've signed up for the GoLive disucssion at Lasso and will post this question there once I figure out how to post queries.
    Carol

  • How do I stop Firefox from opening with the last site I was on when I closed instead of using my home page?

    whenever I open firefox after closing it down, it always opens with the last page I was on. I have the settings to point to a specific homepage and have it set to always open on the homepage, but it doesn't.

    I am having a similar problem, I'm using "Show my home page" on start-up but firefox decides to always open to the last page visited regardless. I also generally close Firefox using the red X or with alt+f4. This problem is especially annoying when the last page 'visited' is an annoying pop-up ad that wasn't been caught by the pop-up blocker.

  • When do I need to use UITableView.insertSections: (and deleteSections:)?

    In a plain UITableView, is it necessary for me to explicitly call insertSections to create the number of sections in my table or is it sufficient to just return the number of sections via my numberOfSectionsInTableView data source method? I've been under the assumption that as long as I return the correct number of sections in numberOfSectionsInTableView, UITableView will take care of creating the proper number of sections in the table. It certainly seems to do that when you initially create your table.
    But my table data can change over time. Rows and sections can come and go. What I've been doing is simply calling reloadData on my table view whenever the underlying data changes and then letting my numberOfSectionsInTableView and numberOfRowsInSection data source methods report to the table the new number of elements. This appears to work some of the time. But sometimes, after a section has disappeared out of the data source, the table view leaves the header view (that gray bar with a section title) visible and floating above the table - even though I've called reloadData and my numberOfSectionsInTableView method returns the new number of sections. At this point, you can't get rid of the section header view.
    What I've discovered is that I must explicitly tell the table that sections have been deleted by calling deleteSections:withRowAnimation:. The converse holds true. If my data source has added new sections, then I must explicitly call insertSections:withRowAnimation:.
    What I don't understand: why do I have to use insertSections to add new sections as opposed to initially, when I created the table, I did not have to use that call. I simply let my numberOfSectionsInTableView inform the table view how many sections there were?
    This is an issue for me because of the way that my data changes. I do not know what sections in my data were deleted. I only know that something changed in the data and I need to repopulate the table.

    have you tried calling "reloadData" on the tableView?

  • Firefox hangs when a file is uploaded using the file selection mechanism.

    A "not responding" condition occurs after about the third selection in the file selection mechanism when I upload or download a file.
    This problem also occurs with Thunderbird when I try to save an attachment and I want to specify a location. I have not noticed this problem on any other application. Window Explorer functions correctly.
    By File selection meachism, I mean the window that appears with the HTML statement <INPUT type="file">.
    This happenen every time when I use this mechanism although not always at the third level, sometimes at the second level, sometimes deeper.

    It is possible that there is a problem with the files sessionstore.js and sessionstore.bak in the Firefox Profile Folder.
    Delete the sessionstore.js [2] file and possible sessionstore-##.js [3] files with a number and sessionstore.bak in the Firefox Profile Folder.
    * Help > Troubleshooting Information > Profile Directory: Open Containing Folder
    * http://kb.mozillazine.org/Profile_folder_-_Firefox
    Deleting sessionstore.js will cause App Tabs and Tab Groups and open and closed (undo) tabs to get lost, so you will have to create them again (make a note or bookmark them).
    See also:
    * [1] http://kb.mozillazine.org/Session_Restore
    * [2] http://kb.mozillazine.org/sessionstore.js
    * [3] http://kb.mozillazine.org/Multiple_profile_files_created

  • Unable to join environment message  and hanging when opening / closing db

    HI ,
    I got the above error message when trying to open the environment.
    Note that before opening I tried closing the db process but it hanged so I killed the process.
    Another phenomenon I got with another database that was about 20 Gigas is that opening hanged, without any error message, for a long time (about 4 hours ) and only then was successfully open.
    So my question is twofold -
    1. What might be the reason for the hang in closing / opening - note that there was no reading/ writing activity on the database.
    2. How should "unable to join the environment message be handled ?
    Maybe this could help diagnose the issue of low opening - the environment folder is filled with many log files created by berkeley db when adding data. Can these files be removed ?
    thanks !!
    Edited by: user10762341 on Feb 3, 2009 5:26 AM
    Edited by: user10762341 on Feb 3, 2009 6:43 AM
    Edited by: user10762341 on Feb 3, 2009 7:54 AM
    Edited by: user10762341 on Feb 3, 2009 9:05 AM
    Edited by: user10762341 on Feb 4, 2009 6:12 AM

    Hello,
    any updates for this case? I'm asking because I have encountered the same issue, and I would like to know what is wrong with my database and how to repair this problem.
    I have 3mln of records in database ( primary database + 3 secondary databases) - start and close take about 5min.
    Thenks for any info,
    pawel

  • When do I need to use a cell editor in a JTree?

    I'm currently trying to add checkboxes to nodes in a JTree. I use a panel containing the check box and a label for rendering. I did this because I want only the checkbox to respond to a mouse click and not the text associated with it. I've read several articles online (including the tutorial) and seen sample code as well. Do I need a cell editor or just have a cell renderer with a mouse listener? I've seen it done both ways.

    Let me rephrase the question.
    If I want to display a checkbox and a label as a node in a Jtree, which way should this be done (with or without a cell editor)? What are the advantages/disadvantages to each approach and what is recommended by Sun?
    I ended up not using a cell editor, but I've read posts on various sites where it was stated that if the user has interaction with the node then an editor should be used (with no other explanation as to why). I guess my main concern is that there might be a down side from not using a cell editor that I'm not aware of.

  • Screen Saver when calling and need to use the Keypad, the screen saver doesn't detect the phone has left the ear and blanks out the screen.  Even ending a call is difficult as the screen blanks out within seconds

    I have to use the Keypad a lot when making calls.  Make the call, the Robot then asks to enter a number for a service, pull the phone down from the ear, the screen may light up for a second, but then the screen saver cuts in, blanking the screen out.  Sometimes you hit the Home Key to awaken the sccreen, enter your number and then back to the ear to hear the next set of instructions.  Back and forth just trying to enter the options is a pain.  Sometimes even trying to end the call, the screen blanks out and you fight to try and end a call.
    If I use the Speaker function the keypad works; the speakler phone is not alway appropriate. 
    It appears that the phone gyro, doesn't detect the phone has moved from the ear to the viewing angle.  This wasn't an issue until recently and I can't remeber if it's the iPhone 5 or one of the updates.  It definitly wasn't there earlier on, as I threw away an Windows 6.5 phone for the same problem. 
    I'm not sure if it's a hardware or software (design) issue.

    It is not the gyro. This has everything to do with the iPhone's prioximity sensor.
    Are you using a case that may be blocking or partially blocking the proximity sensor? If you are using the case, remove the case prior to the next call to see if the same occurs without the case.

Maybe you are looking for