• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

App doesn't always close out

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I have an app I'm testing before sending it out to the users.
I will run the app, and close
out of it, by either pressing the exit button I have added, or clicking
on the X in the JFrame. Usually when I do this, the DOS prompt will display "Press any key to continue" so I know it has closed out. Every once in a while, this message doesn't appear on the DOS prompt. When I look in task manager, the java.exe still shows as a process.
This is the class I have that is supposed to close out the app,

I have the above window listener added to the JFrame.
Here is the code that runs when the exit button is pressed...

Why doesn't the app always close out? I would say about 90% of the time,
it closes OK, not sure what is happening to cause this.
Any ideas?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, pretty clear that the call to DBConnection.closeConnection() is hanging.
You could confirm this by pressing control-break in the DOS window the next time this happens - you should see a stack trace, and you should find this call in progress.
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. I tried doing a control-break in the DOS prompt, and it didn't do anything. I also removed the code that closes the connection to see if that is what was hanging, and ran the app again, and it still doesn't close out.
What are some reasons why the close to the connection would be hanging?
If it was the close statement hanging, why didn't it come back when I took out that code?
Am I closing the connection the wrong way?
It hangs everytime that I run the app now, only way to not get it to hang is to restart the PC.
Also, right now, I am getting the (static)connection from the DB2connection class everytime I call a stored procedure. After getting my data, I am closing out the CallableStatement (I was told before the statement should close the result set so I didn't need to call close on the ResultSet as well), and I only call close on the acutal connection to the DB when the user exits the application. Is this correct, or should I close the connection to the DB after each stored procedure is called?
Thanks again!
[ August 16, 2003: Message edited by: Jennifer Sohl ]
[ August 16, 2003: Message edited by: Jennifer Sohl ]
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm moving this to The JDBC Forum...
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello! I was wondering if anyone had any more ideas on this issue.
I would say the app is closing out about 60% of the time.
I do a lot of testing, so I end up rebooting my pc a few times a day to get rid of all the 'java.exe' processes eating up my memory.
I have tried to end the processes through task manager, but it tells me
it cannot end the process. Access is denied.
Thanks again for any help!
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of the JDK are you using? I noticed that this happened with 1.3 and 1.4.0 in Windows XP quite a bit. But I haven't had a single problem from 1.4.1 and 1.4.2.
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also removed the code that closes the connection to see if that is what was hanging, and ran the app again, and it still doesn't close out.
If you comment out everything that you have in windowClosing(), except System.exit(), would the problem still be there? If your app still doesn't exit, it means the event just doesn't fire.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic