|
Distributable Singleton
[Previous]  [Next] 
|
![]() |
User Manual [Previous]  [Next] Distributable Singleton
In a distributed system, a singleton class could mean two different semantics. One is that the class
has only one instance on each node. The other semantic is to assume that there is only one instance
of the object in the whole system. The developer can choose which semantic to be used for the
singleton class. If a singleton class is also distributable, it means there should be only one instance of
the class in the whole system and remotely accessible by other nodes. Otherwise, there can be one
instance on every node. SingletonClass.getInstance().getName();
Alternatively, a specific runtime
component can be given as a parameter of the getInstance() method. In this case, there will
be a single object on each node. SingletonClass.getInstance(UmpleRuntime.getComponent(“component1”)).getName(); |