Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI MVC client calls hang  RSS feed

 
Rich Stepanski
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've written an mvc style program that will use RMI to speak between the view and model.

Program works without using RMI (setting up model and view in same JVM) however when I try to use RMI I have problems. I have successfully bound my Model to the registry ( the view can get data from it, etc). My view implements the Remote interface and I use the UnicastRemoteObject.exportObject() method to export it in its constructor (I've tried exporting it in my main block also).

It seems to be exporting alright however any calls to it from the model hang.

I say its exporting alright because I can't export it a 2nd time ( already exported warning) and I can unexport it when I close. Any calls to the view from the model hang however. If I make 2 of the same calls (event driven) I get a ConcurrentModificationException. ( I use an iterator to go through my list of view listeners to notify of a change).

Anyway , I have no idea why my call is hanging. Like I said it works fine if I run everything in one JVM without any RMI. Anyone have any idea or suggestions about the hanging call? Thanks.

Rich
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you doing something where the View makes a remote call to the Model, and inside that method the Model makes a remote call back to the view? If so, you're going to need to either:
  • Create new threads in the Model to call the View
  • Add code in the Model to make sure the Model isn't calling the View that called it.
  • Redesign your app so the Model doesn't need to call back to the view
  •  
    Rich Stepanski
    Ranch Hand
    Posts: 59
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Well I changed my view to not call the Model. However, it seems the Model simply can't make any calls to the view at all. I'm going to assume its not being exported correctly - although a toString on the view the model is trying to call says its a ViewImpl_Stub and it knows the IP and objID for it.

    When I say cant make any calls to the view - I mean the program tries to call the view and just hangs. The method is never entered, or at least nothing is printed in the model or view's console ( changed view's method to just print 'hi' and it still hung )

    This is my view's constructor - theres got to be something wrong with the order I do things.... anyone who takes a look - thanks. Any help is appreciated.

    I'm going to cut out the GUI filler to make this easier..



    Thanks again.
    [ May 12, 2005: Message edited by: Rich Stepanski ]
     
    Rich Stepanski
    Ranch Hand
    Posts: 59
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    one of the classes I used for data didn't extend Serializable. Thats what caused the hang.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!