Java RMI unbind problem.

G

Gama Franco

Hi,

I'm using RMI in my application, but I faced a little problem. When my
program finishes I unbind the RMI object from the registry but the
program doesn't exit after that. I need to press ^C to quit the program.

What did I miss?

Best regards,
Gama Franco
 
G

Gerbrand van Dieijen

Hi,

I'm using RMI in my application, but I faced a little problem. When my
program finishes I unbind the RMI object from the registry but the
program doesn't exit after that. I need to press ^C to quit the program.

Doesn't system.exit(..) work?
 
G

Gama Franco

Gerbrand said:
Doesn't system.exit(..) work?
It worked, thanks.

Is there any reason for the System to hang when the method main is
supposed to return?

Gama Franco
 
R

Roedy Green

Is there any reason for the System to hang when the method main is
supposed to return?

Most of the interesting stuff happens in a GUI app ONLY after main has
exited. The AwT or Swing thread in still alive fielding keypresses and
mouse clicks.

You need to close all the gui stuff down or call System.exit.
 
G

Gama Franco

Roedy said:
Most of the interesting stuff happens in a GUI app ONLY after main has
exited. The AwT or Swing thread in still alive fielding keypresses and
mouse clicks.

You need to close all the gui stuff down or call System.exit.

I'm using the console, and I'm just curious to know why this happens.
 
R

Roedy Green

I'm using the console, and I'm just curious to know why this happens.

The rule is the program keeps going until the last thread dies. It in
100% console app, the thread running main has nothing else to do after
running main so it dies.

Either than thread or some other thread is still alive fielding gui
events. That thread only dies when the last frame closes, and
sometimes not even then (I think this may be a bug in Swing). So I
kill explicitly when the last frame shuts down.

As I said before, the easiest way it to capture the close of the
master frame and exit . See http://mindprod.com/jgloss/jframe.html
for details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Java RMI questions and MyEclipse 8
RMI in java 15
JAVA RMI PROBLEM 0
Java RMI - registry questions 3
RMI & connection refused 10
Java matrix problem 3
RMI server lifecycle/threading 1
RMI little problem 1

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top