• Post Reply Bookmark Topic Watch Topic
  • New Topic

JVM Behaviour- Kill JAVA Process  RSS feed

 
Ramesh Sunkara
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

I have a standalone application.

Sometimes it hangs. Its gui is developed in swings. I can't find the reason why it is hanging.

So to restart my app, am using windows end process. Here am killing java process.

I want to know what happens when I killed java process.

Will it halt JVM abruptly?

If data is in some state will that state of the data(object) will be saved or how the behavior will be?

Thanks in advance
Ramesh
 
Stephan van Hulst
Saloon Keeper
Posts: 7969
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you kill it, you kill it. Nothing will be done after that point.

It sounds like your program reaches deadlock. I'm guessing this is because you're making changes to your GUI from another thread than the Event Dispatch Thread (EDT).
Put a few println statements in your program to identify where it hangs, and then post that part, and we can have a look at it.
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And run it from the command line using java -jar. That way you will see every exception that's being thrown and not caught by your code (like RuntimeExceptions from event handlers).
 
Ramesh Sunkara
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys for you valuable time.

I will try to follow your steps and get back.

My understanding from your posts:

When you kill java process,it directly kills JVM right?

 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Be careful though that you kill the right java process. If you have multiple JVMs active they will all show up as "java" in the Windows task manager.

Running from the command line as I suggested earlier can give you a workaround. As long as the JVM is running the java command does not end. If you press CTRL+C in that command prompt window it will also terminate your application.
 
Ramesh Sunkara
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried to run from command line. Then its not hanging.

My problem is I can't reproduce the same behaviour(hanging).

It hangs indefinitely.
 
Stephan van Hulst
Saloon Keeper
Posts: 7969
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your code?
 
Ramesh Sunkara
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
am sorry stephan...I can't do that.
One reason is its my company property.
Second reason:Its too big to post here

Thanks for your concern
 
Stephan van Hulst
Saloon Keeper
Posts: 7969
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, Ramesh, then you'll have to settle with advice.

It sounds like a deadlock. See what threads you are using, and where in your code they interact. By interact I mean, where do they work on the same objects?

I have a feeling you are making updates to the GUI in a thread other than the EDT. Are there any Swing component methods you are calling from a thread other than the EDT?

Here's a mistake I would often make: Some event happens in your GUI, and you create a new thread in the listener to handle it, so the EDT can continue and your GUI will remain responsive. Your new thread will work on some data, which is fine, but then you add new items to a JComboBox or something like that, from the same thread.
 
Ramesh Sunkara
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stephan

I am following your suggestions and debugging.

If I got any thing I will post the information.

Its a huge stupid framewrok I have to use which was imported from other company.

anyways thanks lot for you valuable time
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!