How can we ensure that there is a single instance of a class in a clustered environment? The class is Serializable.
views:
93answers:
3
+1
A:
You need to correctly implement readResolve method of your singleton class.
Preferably, I think terracotta would help.
This link has more help http://forums.terracotta.org/forums/posts/list/771.page
Gopi
2010-07-19 10:54:39
+2
A:
Use a container that provides application scoped singletons, e.g. Seam, Spring etc.
seanizer
2010-07-19 11:42:15
How will that help in a cluster?
skaffman
2010-07-19 12:43:47
obviously, your cluster has to run a single such container
seanizer
2010-07-19 13:11:21
A:
- Use container which provides you with this facility.
- If use of container is not a feasible option, then create a RemoteFactory which will provide you with instance of the class in context.
Tushar Tarkas
2010-07-19 12:39:01