Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interesting problem with RMI server and event handling

 
Greg Georges
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
Well I have just discovered a very interesting bug in my application which I have no explanation. Here is the situation:
I have a user interface (GUI) for my server. In this GUI there is a start button to start the server. This button has an action listener implemented and listens for user clicks. Then, I create a registry object as follows

Everything works perfectly, however when I put a breakpoint in my server code I noticed that the event is always doubled, meaning that one click on the start button makes two events, and an exception is raised saying
An error has occured while trying to create the registry: internal error: ObjID already in use
Very weird, I have no explanation for this, could it be a bug in the event handling in windows? Also, this never happened before I added a GUI to the server, therefore I suspect the event handling. Maybe a singleton would be a good idea in this case, has anyone also had this strange problem?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well they easy way aroung this, is to automatically start RMI Registry as soon as the command line to run the server code is started, then only have a Stop Button on your GUI.
Mark
 
Greg Georges
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well everyone it is solved, I had called my addComponents method twice, therefore adding two instances of the listener, pretty basic error, next time I will double check before posting LOL
 
James Du
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I wonder if the server side need a GUI as well
James Du
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic