Singleton in Cluster environment

前端 未结 9 473
南笙
南笙 2020-12-04 11:23

What is the best strategy to refactor a Singleton object to a cluster environment?

We use Singleton to cache some custom information from Database. Its mostly

9条回答
  •  [愿得一人]
    2020-12-04 11:48

    Replace your singleton cache with a distributed cache.

    One such cache could be JBoss Infinispan but I'm sure that other distributed cache and grid technologies exist, including commercial ones which are probably more mature at this point.

    For singleton objects in general, I'm not sure. I think I'd try to not have singletons in the first place.

提交回复
热议问题