Skip to main content

Issues with using Remote and with shutting down all threads

  3 posts   Feedicon  
Replies: 2 - Last Post: July 05, 2011 13:53
by: LizardSF
showing 1 - 3 of 3
Posted: June 30, 2011 15:00 by LizardSF
I have two problems I'm hoping I can get help with.

First, to solve some issues with passing by value instead of by reference, I took the advice of the documentation and wrapped an object in a Remote() call. This created an oddity, in that the object as seen be the class that receives it is remote_stub, not remote. Because other objects manipulated by the same code are wrapped in remote, I have ended up using the very clunky "if(s.getClass() == Remote.class)" to handle the different wrappers (Remote and Remote_Stub). This is kludgy and ugly and makes me feel very stupid for not understanding the underlying mechanism better, but it works for testing purposes.

The second issue is that when I shut down the app, there are many objects still instantiated. What is the best way to shut down/dismiss/get rid of a cajo object? It seems that there's still pointers to them in the JVm, and unless I use ctrl-c or otherwise force shut down, they remain.
Posted: June 30, 2011 19:50 by John Catherino
Addressing your first issue: yes, what you will receive is a remote reference object, not the object itself. If the client and server share a common interface to the object, a dynamic proxy can be created for the reference, either by the server, or the client, using the utility method proxy, from cajo.sdk.AbstractObject.

With regard to your second issue: yes, the JVM resists shutting down when there are service objects actively exported. This is simply to let you know that you may be upsetting remote clients. There is a utility method shutdown() from cajo.sdk.AbstractServer, as you might guess, it forcibly unexports all service objects.

Hope this helps, please let me know if you need any more information.

John
Posted: July 05, 2011 13:53 by LizardSF
Thanks for that; I'm about to try it out. I wanted to note that even with some of the problems I've had with implementation, Cajo has solved a problem with distribution of work that's been vexing us for over a year, and did so with about ten lines of code, so I'm quite enthused by it.
Replies: 2 - Last Post: July 05, 2011 13:53
by: LizardSF
 
 
Close
loading
Please Confirm
Close