RMI using a Singleton creates some objects on client
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Freddy_Lugo
Posted On:   Monday, November 25, 2002 08:01 AM

I have an RMI Singleton object running on the server side. This singleton is called by the client. The singleton has many custom objects which I tested and all of them are created on the server side (as expected). However I have two objects created as inner classes which implements different custom interfaces. These objects are created locally on the client and I don't know why. My declaration are like follow: final class Singleton { private static Singleton s = new Singleton(); private Singleton() { } public static Singleton getReference() { return s; } Myobject ob1 = new Myobject();    More>>

I have an RMI Singleton object running on the server side. This singleton is called by the client.
The singleton has many custom objects which I tested and all of them are created on the server side (as expected). However I have two objects created as inner classes which implements different custom interfaces. These objects are created locally on the client and I don't know why. My declaration are like follow:


			
final class Singleton

{

private static Singleton s = new Singleton();

private Singleton()

{



}

public static Singleton getReference()

{

return s;

}

Myobject ob1 = new Myobject();

Myobject2 ob2 = new Myobject2();

Myobject3 ob3 = new Myobject3();

Myobject4 ob4 = new Myobject4();

Myobject5 ob5 = new Myobject5();

}
private class MyObject4 implements Myinterface,Serializable

{

//Some methods use ob1

. . .



}

private class MyObject5implements Myinterface2,Serializable

{

//Some methods use ob2

. . .



}



I checked and ob1, obj2 and obj3 are created on the server but ob4 and ob5 are created on the client. The only difference I have found between then is thar ob4 and ob5 are inner classes and implements a custom interface. All of them implements Serializable too.



This singleton is a wrapper for the RMI Object Implementation which handles all the Remote Exceptions for the object. Everything is working ok, except for the objects mentioned before.


Any guess?



Thanks,


Freddy    <<Less
About | Sitemap | Contact