Swing application eats CPU on resume after standby

My application contains a mix of regular Swing components and about 200 (small) custom components (JPanels) that draw themselves. The problem is that if put my laptop into Standby, then restart it, the application eats CPU. It goes from ~4% pre standby to ~48% after standby. Totally repeatable. There is only the main thread, the AWT thread and a couple timers firing: one to get data from a server and one to redraw the custom controls to make the control blink (calls repaint() to cue up a call to paintComponent()). I put timing code in the two timer driven threads and both are running fine. NOTE: each of the custom components is just a rectangle with a short text string in it. Think checkerboard with text. The background color is all that is being changed. It's basically a grid of alarm/status "lights".
I did some searching and only found a reference to a drawing bug that was fixed back in 1.4.x that had to do with WinXP and dual-headed computers.
Note that another simple Swing application I wrote (no custom controls), doesn't appear to behave this way, so I suspect it has to do with the custom drawing stuff (rolling my own paintComponent() method).
Any thoughts on how to figure out what is eating the CPU? I'm using NetBeans 6.7 and JDK 1.6_14 under Windows XP.
Edited by: garrysimmons on Sep 15, 2009 1:52 PM
Edited by: garrysimmons on Sep 15, 2009 2:57 PM
Edited by: garrysimmons on Sep 15, 2009 3:02 PM

It doesn't matter if it's a Swing timer or a Util timer. It behaves the same either way. That was one of the first things I tried.
I ended up refactoring the code to go from a grid of individual controls (think checker board where each square is a control that draws itself), to a single "board" control that draws a grid. That seems to have fixed the issue. I can go in/out of Standby and the app doesn't eat a ton of CPU any more. The real problem may still be there, just too small of an effect to notice.
I don't know why the original design would work fine before a Standby, but not after. Having ~200 little controls doing repaints twice a second must confuse something in the JVM/Windows versus having 4 large controls doing the same amount of drawing.
It's working, so time to move on.

Similar Messages

  • 2 questions about SmartWare (password protection, resume after standby)..

    Hi guys, 2 quick questions about the SmartWare utility. I have searched for previous answers, but couldn't find any. Might be that I uses the wrong search terms though, so sorry in advance if this had been asked (and aswered) before. When I create a backup, it is being stored file-by-file in the "SmartWare" folder on the NAS. Since the SmartWare folder is public, all users with access to the drive can access this folder. Ultimately this means that ALL users of the drive can access the backup files of ANY user. If someone performs a full backup, this means that anyone has access to ALL the data of that person. I could't find any option in SmartWare to password-protect backups or something. From a security point of view, I would consider this as a worst-case scenario. Even worse is that there is no mentioning of this in the user's manual. Am I missing something here? Is there a way to protect backups against access by any other user? If this is really not possible, I would consider this application to be pretty much useless, to say the least. "Dangerous" would be a better description... My 2nd question is only relevant if there's a solution for the first one, because else I would't use this tool anyway: Does it automatically resume a backup if the machine is put to standby or hibernation mode during a backup operation, or will it restart from the start, or will the backup be interrupted (and thus useless)? Many thanks in advance!

    One can create a Private Share on the WD My Cloud, configure it so only one user has access (password protected), then one can configure the SmartWare software to backup to that private share folder. One changes the backup location in the SmartWare program by selecting the dropdown selector box below the "WD My Cloud" on the Smartware "Home" screen. The Smartware User Manual explains this process under Chapter 5, Backing up Files, step 2, substep c. Smartware should resume the backup when ever it is interrupted. Here is how it is explained in the Smartware User Manual:Note: Backup protection is automatic for as long as the backup source and target devices are connected to your computer. Then, whenever you disconnect and reconnect either device, the WD SmartWare software rescans the backup source device for new or changed files and resumes automatic backup protection. 

  • Exception handling for eventlistener inner classes in swing application

    Hi,
    This is probably sooo easy I will kick myself when I find out, but anyway here goes...
    I have an inner class thus...
              cmbOffence.addFocusListener(new FocusAdapter() {
                        public void focusGained(FocusEvent e) {
                             cmbOffence_focusGained(e);
                        public void focusLost(FocusEvent e) {
                        try {
                             cmbOffence_focusLost(e);
                        } catch (XMLConfigurationException xce) {
                   });where cmbOffence.focusLost(e) is looking up to a class that throws an exception which should be fatal i.e. the swing app should close. I want to handle this exception gracefully so therefore want to throw the XMLConfiguratinException to the main application class. How do I do this?? I guess this is more of an inner classes question than a swing one per se, but any help would be appreciated.
    Thanks
    Conrad

    I think you're maybe confusing classes and threads. In the typical Swing application the "main" thread finishes after openning the initial window and there really is no main thread to report back to. In fact the dispatcher thread is about as "main" as they come.
    To exit such a program gracefully is usually a matter of cleaning up resources and calling dispose on the main window, which you can perfectly well do from the dispatcher thread.
    I usually wind up with some centralised method to deal with unexpected exceptions, for example as part of my desk top window in an MDI, but it's called from the dispatcher thread as often as from anywhere.

  • 35% CPU after resume from Standby

    After comming out of standby, CPU runs at 35% busy for a long time (30 minutes or more). Reboot and CPU is 2%. Is there a reason why resuming from Standby is crippling the system. The CPU time is in a SYSTEM process with no other information (Task Manager) and just runs and runs and runs.  The system is 4 days old and I have not made changes to the BIOS settings.

    Thanks for the reply but the solution related to a docking station problem and I do not have a docking station. But the problem has gone away. Why? I do not know. That is actually more distressing because there was no cause to link the problem to. So who knows when it will just start again. I did change the power options to not hibernate but then changed them back. The change seems to have made the problem go away. Turn it off then back on and it runs differently. Not very comforting.

  • K8t Neo2 problem with resume from standby after BIOS flash

    Previously while using the 3.2 BIOS and a Winchester 3200+, Both Standby and hibernation worked perfectly almost without fail.  Since I flashed the BIOS to 9.3 and installed an X2 4200+ I have had a problem with resume from standby.  The machine starts up OK but the 2nd processor core (cpu1) is almost maxed out and stays that way.  Task manager shows total cpu load as about 45-50% (all on cpu1) but shows no running process using any cpu load, just the usual System Idle process at about 99%.  The only way to get it back down to normal again seems to be to reboot.  By Contrast Hibernation works fine, with no increase in cpu load after resume.  I have all the latest MS patch's installed (I think!) the AMD dual core driver and the MS and AMD dual core optimizers.  Any ideas what is going on?

    Noticed last night that S! standby seems to work OK.  Also was experimenting with a fresh windows install on a spare hard drive (checking on another problem).  The fresh windows install appeared to work with S4 hibernation, so it looks like that is the answer to that problem.  However the problem with high cpu load on the second core after resume from S3 suspend to RAM standby was still present.  This problem is so specific and so repeatable (it does it every time without fail), that I feel there must be some very well defined reason for it.  Unfortunately I have no ideas what could be wrong. Have now tried Windows re-install, latest cpu drivers, AMD dual core optimizer, MS dual core optimizer, Cool'n'quite disabled/enabled, and various others and suspend to RAM still gives the same behaviour

  • USB ports don't work after resuming from standby with Windows 8 on X230 tablet

    I have just done a clean install of Windows 8 on my X230 tablet.  Before installing Windows 8 I installed the most recent BIOS for this machine (version 2.50).  After installing Windows 8 I installed System Update from the Lenovo Website and downloaded all the recommended drivers and other files.  I've also installed all the latest Windows 8 updates.
    Here are the symptoms of my problem: After resuming from standby/sleep mode, my USB ports do not work.  My computer has two USB 3.0 ports and one USB 2.0 ports.  All exhibit the same behavior.  After resuming from standby mode I have tried inserting both my mouse and a USB thumbdrive, but neither are recognized.  After restarting Windows, the USB ports work again... until I resume from standby mode again.
    I hope there is a solution to this issue.  It is very frustrating.

    Thanks for the suggestion about tweaking the "Allow this computer to turn off this device" feature.  I un-checked that box for every entry I could find under "Universal Serial Bus Controllers" in the Devide Manager.  Unfortunately, the same symptoms of my problem persisted.
    I went back and looked at the README file associated with the BIOS 2.50 download on Lenvo's support site.  At the bottom of the file it gives a "Summary of Changes".  Under version 2.03 of the BIOS (the version just before version 2.50), it says:
    - (Fix) Fixed an issue where USB device might not detected when system resume from sleep mode.
    This indicates that Lenovo support was already aware of such issues.  The problem was intended to be fixed in version 2.03 of the BIOS.  However, the issue persists on my machine, even with the latest BIOS.
    Hopefully someone from Lenovo can comment here.

  • After 10.4.3 upgrade, problems resuming from standby

    I have a Powerbook G3 Pismo 400 MHz with 576 MB RAM. After upgrading to 10.4.3, every time I open the lid to resume from standby, the powerbook freezes, even when no programs are open. It shows the desktop as it was previously, but the mouse will not move, the keys have no effect, etc. This lasts for approximately 25-30 seconds, after which time it becomes responsive again and acts normally.
    I've noticed that this occurs if I have the powerbook plugged in to the A/C, but don't have the battery in. If I put the battery in, it doesn't exhibit this problem. I've tried fixing the disk permissions, and reinstalled from the combo update download, but that didn't help.
    Has anyone else experienced this, is there a solution, and does Apple monitor this forum for bug reports, or is there another way to submit a bug report?

    Thanks Dave; I tried dragging the folders on the CD onto the desktop and they copy okay, and indicate by size they are full. They open on the desktop with all showing in them. So I copied all the CDs I use and re-burned them -- they will now read okay so I do not need to drag files to the desktop first, but can get it right from the CD. Seems like a lot of extra hassle for something that should be very simple to do. ;-} Again, i appreciate your suggestion, and quick response.

  • Windows 8 won't find any airport after resuming from standby

    Hi,
    I have had a windows 7 PC with both airport express (2nd and 3rd generation) working flawlessly. I bought a new Windows 8 Laptop. Initially everything worked fine, but after resuming from standby mode (closed the display and reopened) my itunes stopped working, and the airport utility software was unable to find both airport express. After shutdown and restart they both worked again until the next standby mode.
    I've read somewhere that it might be a conflict with IPv6 so I disabled it from registry, but the problem remains.....
    any thoughts
    Regards,
    German

    Did you upgrade the drivers from the wireless card manufacturer in win8 machine.. ??
    If that doesn't work.. do some more basic wireless investigation..
    1. Are wireless names SMB compliant.. ie short, no spaces and pure alphanumeric?
    2. WPA2 Personal security with a password which also conforms to the above.
    3. Test with fixed wireless channels. 11, 6, 1
    4. If none of the above work.. turn off security for a few minutes and see if that works.

  • Under Windows 7 - Fingerprint Reader Ignored After Standby Resume

    I thought this was perhaps a platform-specific issue.  But both on my ThinkPad T61 running Windows 7 Ultimate 32-bit and my new ThinkPad T510 running Windows 7 Enterprise 64-bit, whenever I resume from standby, any finger swipe against the fingerprint reader is ignored. 
    Note - I am not using the rather large Lenovo fingerprint driver package because I don't want the bloat.  Just want a very basic, Ctrl+Alt+Delete password prompt replacement.
    Does the "Registry patch to change IDLE IRP timing by Fingerprint reader driver for Windows Vista" need to be installed under Windows 7 (http://www-307.ibm.com/pc/support/site.wss/document.do?sitestyle=lenovo&lndocid=MIGR-67245)? 

    i didn't know the lenovo fingerprint driver package was more than just a very basic, Ctrl+Alt+Delete password prompt replacement? (at least not that i noticed)
    T400s - 2815RW1 + Win7 Ultimate
    Don't pm me for help! That's what the forum is for. Also, Google's nicer than me. Ask him.

  • Problems After shifting swing application from jdk1.3 to 1.4

    hi,
    i have shifted my Swing application from jdk1.3 to 1.4, some component settings changed in j2se1.4. are listed below
    1). i have added JComboBox to JPanel using BoxLayout, in jdk1.3 it is normal where as in 1.4 comboBox height is increased to panel height.
    Sample code
    (in a Panel)
         setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(getYearComboBox());
         add(getMonthNameComboBox());
         add(getDayOfMonthComboBox());
    2). in jdk1.3 the icon which is set to JFrame is visible in the JOptioPane.showConfirmationDialog() also, but in 1.4 the icon is not visible in conformation dialog box.
    Sample Code
    in a JFrame's constructor
    public OptionPaneTest()
    ImageIcon icon = new ImageIcon("icon.gif");
    setIconImage(icon.getImage());     
    setSize(250,100);
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
    setVisible(true);
    JOptionPane.showMessageDialog(this,"hai", "Hai",JOptionPane.WARNING_MESSAGE);
    3). the Labels added to the panel or frame are displaying in light blue color with jdk1.3 and the same label displaying in black with j2se1.3
    Sample Code
    in a JPanel
    setLayout(new BorderLayout(20, 20));
    add(new JLabel("Testing Label Color"), BorderLayout.CENTER);
    please send solution to any or all.
    thanks in advance,
    Pavan.DV

    Thanks for your sugession.
    You realized me by showing the fact that there are no many classes
    Keep suggesting like this.
    I don't even know how to see the API documentation Before you told me.
    Don't take any issue as simple thing and never give foolish suggessions like this.
    If you know the Answer then share it or else musukoni kurcho ra

  • X31 WinXP USB after standby Code 38

    Hallo everyone!
    I have a very annoying problem. My Thinkpad X31 supports internally only 802.11b that is too slow today. So I got Fritz!WLAN USB Stick which can 802.11g.
    The Problem: The stick stops to work after standby. Worse: Not always. Rarely It works after first standby but by second one for sure. In Device Manager under USB controllers I can see that  "USB mass storage device" has a trouble : 
    Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory (Code 38)
    I guess there is not a problem with WLAN USB Stick but interplay of Windows driver with hardware.
    Has anyone idea how i get clue with this problem?
    Thanx in advance
    P.S. Microsoft  recommends to restart pc. funny guys. :-E

    It doesn't matter if it's a Swing timer or a Util timer. It behaves the same either way. That was one of the first things I tried.
    I ended up refactoring the code to go from a grid of individual controls (think checker board where each square is a control that draws itself), to a single "board" control that draws a grid. That seems to have fixed the issue. I can go in/out of Standby and the app doesn't eat a ton of CPU any more. The real problem may still be there, just too small of an effect to notice.
    I don't know why the original design would work fine before a Standby, but not after. Having ~200 little controls doing repaints twice a second must confuse something in the JVM/Windows versus having 4 large controls doing the same amount of drawing.
    It's working, so time to move on.

  • T60 Slow to Resume from Standby

    I have noticed that ever since replacing my HD, because of (1) bad sectors and (2) it was getting noisy, it takes a long time for my T60 to resume from standby, sometimes 2 - 5 mins before it gets going again. If I shut down and restart all seems to be fine although not as fast as pre HD replacement. It seems only to be a problem when I go to and from standby. Any ideas?
    Recent changes that may have impacted - I replaced my OEM 60G HD with a WD 500G HD by cloning the HD using Acronis. I didn;t reload the OS. I did have to change some BIOS settings to get the new HD to be recognised by the BIOS - something about compatability mode - not 100% sure. I'll add more details once I reboot and check these. (it was AHCI to Compatability I have since changed to AHCI again to see if this has an impact). Otherwise all else is the same. I originally cloned the HD to extend the partition to the full size of the new HD but noticed it was a lot slower and had an annoying habit of accessing the HD on a regular (approx) 1 sec interval even when idle. So I changed the partition size to about 100G thinking it would have to span physically less of the HD using Paragon HD Manager and it did make it faster.
    I have Win XP SP3 2G RAM, T60 with Intel CPU T2400 @1.83GHz

    Sounds to me that you should get your harddrive checked. You shouldn't notice any difference in speed between a 60GB drive and a 500GB drive, apart from the fact that the 500GB drive should in theory be faster. At least given if they're both the same RPM (5400 or 7200 most likely).
    If the problem persists, even after running a hardware-diagnostic, I'd recommend reinstalling. Changing the harddrive by cloning it shouldn't present any problems of this kind, but one never knows - it's amazing what can be solved by reinstalling, sometimes
    IT-technician, running my own company in Bergen, Norway
    Thinkpad T61, 8895CTO C2D 2Ghz/4GB/120GB SSD/1400x1050

  • Connection to windows server sometimes fails after standby

    Hello,
    I am using a Macbook Pro with 10.5.5.
    Connections to Windows file servers works well. But sometimes after resuming from standby the it is not possible to connect. The "Connect to..." hangs and in the konsole i see:
    23.11.08 11:37:34 com.apple.launchd[90] (com.apple.netauth.useragent[3770]) Exited abnormally: Segmentation fault
    After rebooting the mac it works again.
    Does anybody know how to solve this?
    Thanks in advance
    Alex

    Hello nobody loopback,
    The following is unrelated to this post, however it is the only way I know to contact you.
    I found this page
    http://discussions.apple.com/thread.jspa?threadID=1218394&start=60&tstart=0
    I have a nearly identical situation where a backed up my entire "Macintosh HD" to a compressed DMG image file. During the restore process on the Leopard Install DVD it froze and I had to force restart. Upon restarting, I found my internal HD with only an Applications folder filled alphabetically with 73 and a half apps ending with a half restored iDVD.app and worst of all my single copy DMG (I know, foolish) reporting a "No mountable file systems" error. Due to the highly proprietary and closed nature of Disk Utility DMG images, I have chosen to contact you directly for help as the Apple Reps turn me to 3rd party data recovery and Data Recovery companies claim they don't do file repair. I feel someone with a wealth of knowledge concerning the DMG file format is my only option.
    I was wondering if you could help me out.
    So what do you say?
    Here is the thread I posted for my case.
    http://discussions.apple.com/thread.jspa?threadID=1699574&tstart=0
    thank you for your time,
    Marcus Schieffert
    marcus3k AT gmail

  • How to give Common Background color for all JPanels in My Swing application

    Hi All,
    I am developing a swing application using The Swing Application Framework(SAF)(JSR 296). I this application i have multiple JPanel's embedded in a JTabbedPane. In this way i have three JTabbedPane embedded in a JFrame.
    Now is there any way to set a common background color for the all the JPanel's available in the application??
    I have tried using UIManager.put("Panel.background",new Color.PINK);. But it did not work.
    Also let me know if SAF has some inbuilt method or way to do this.
    Your inputs are valuable.
    Thanks in Advance,
    Nishanth.C

    It is not the fault of NetBeans' GUI builder, JPanels are opaque by default, I mean whether you use Netbeans or not.Thank you!
    I stand corrected (which is short for +"I jumped red-eyed on my feet and rushed to create an SSCCE to demonstrate that JPanels are... mmm... oh well, they are opaque by default... ;-[]"+)
    NetBeans's definitely innocent then, and indeed using it would be an advantage (ctrl-click all JPanels in a form and edit the common opaque property to false) over manually coding
    To handle this it would be better idea to make a subclass of JPanel and override isOpaque() to return false. Then use this 'Trasparent Panel' for all the panels where ever transparency is required.I beg to differ. From a design standpoint, I'd find it terrible (in the pejorative sense of the word) to design a subclass to inconsistently override a getter whereas the standard API already exposes the property (both get and set) for what it's meant: specify whether the panel is opaque.
    Leveraging this subclass would mean changing all lines where a would-be-transparent JPanel is currently instantiated, and instantiate the subclass instead.
    If you're editing all such lines anyway, you might as well change the explicit new JPanel() for a call to a factory method createTransparentJPanel(); this latter could, at the programmer's discretion, implement transparency whichever way makes the programmer's life easier (subclass if he pleases, although that makes me shudder, or simply call thePanel.setOpaque(false) before returning the panel). That way the "transparency" code is centralized in a single easy to maintain location.
    I had to read the code for that latter's UI classes to find out the keys to use (+Panel.background+, Label.foreground, etc.), as I happened to not find this info in an authoritative document - I see that you seem to know thoses keys, may I ask you where you got them from?
    One of best utilities I got from this forum, written by camickr makes getting these keys and their values very easy. You can get it from his blog [(->link)|http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/]
    Definitely. I bit a pair of knucles off when discovered it monthes after cumbersomely traversing the BasicL&F code...
    Still, it is a matter-of-fact approach (and this time I don't mean that to sound pejorative), that works if you can test the result for a given JDK version and L&F, but doesn't guarantee that these keys are there to stand - an observation, but not a specification.
    Thanks TBM for highlighting this blog entry, that's the best keys list device I have found so far, but the questions still holds as to what specifies the keys.
    Edited by: jduprez on Feb 15, 2010 10:07 AM

  • X240 fingerprint reader does not work after standby or lockscreen

    Hello all,
    I have a new X240, and the fingerprint logon no longer works after the computer resumes from standby or from a lockscreen (screen saver). I have checked other solutions here and in other sites, namely:
    1. unchecking the power option of the fp reader in device manager,
    2. and switching the 30-day standby in Lenovo Settings
    Neither of those solutions have worked. I have the latest BIOS and FP driver versions. I made sure the the FP was enabled in BIOS, and I even switched the settings to allow internal FP reader only. Still, the FP will only work when I first power on the laptop, but not after resuming from stand-by. I have checked in Device Manager after manually entering the password, and it says that the FP is working properly.
    I am at a loss, and I want to exhaust every possibility before I call tech suppport. Any suggestions would be appreciated. 
    X230
    x200
    T410
    X240
    TP Tablet 2
    Solved!
    Go to Solution.

    Fixed.
    I normally use System Update to check for newer versions of Lenovo software. SU didn't catch that there was a new version of FP reader. Just to be sure, I doublechecked on Lenovo's website, and lo and behold, there was a newer version of the FP reader. I had to download it and manually uninstall the previous version. It's fine now. However, I don't understand why Lenovo does this - why does SU not catch updates? It's not the first time that this happens, by the way, nor is it limited to this laptop (I own or have owned a T60, X61, X200, X201, X230, T410, and now the X240). 
    In any event, the FP is working properly now. I hope this helps someone else. 
    X230
    x200
    T410
    X240
    TP Tablet 2

Maybe you are looking for

  • Captured video not in sync with audio

      I capture video and audio from a Sony Beta SX A-75 using the SDI output through Blackmajc card into dual 2.5. We are using DV compression. The audio is out of sync after capture. It is 3 frames off. If I slide the video 3 frames to the right on the

  • Urgent Issue:Err-REP-50125 : java.lang.ClassNotFoundException  - 11.1.1.3.0

    I'm trying to use custom destination with oracle fusion middleware 11.1.1.3.0 In-Process report server. I have added a custom destination section in the rwserver.conf file. Added the (customdest.jar - my jar file) jar file to the system classpath and

  • Human Task generated Forms

    Hi, Human Task form generation generated set of forms and web app folders. Can this be directly deployed on the servers or is it just the template and lot more work needs to be done here? There were two directories one for War and another for ear fil

  • Oracle SOA Suite Adapter integration vs Oracle AIA

    HI, Oracle soa suite provides the environment to make use of existing service by providing oracle adapters including Legacy,package and application adapters. futher which suituation and why need to use oracle AIA in order to make use existing resourc

  • Idea for next version of Photoshop

    Tear off tools the same as Illustrator for re-using common ones. Also the pen tool - To have a shift or Ctrl key to minus an anchor point. At the moment you have to go back to the tool bar and select the minus anchor point Any thoughts?