ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What can be done in distributed environment for singleton to work?does any orm supports this feature in distributed environment?

user-image
تم إضافة السؤال من قبل Kais Hamdulay , Technical Lead , Barclays
تاريخ النشر: 2016/03/10
Mohammad Shahnawaz Akhter Shahnawaz
من قبل Mohammad Shahnawaz Akhter Shahnawaz , Checker Module , Addition of Msisdn

When an Application is Distributed across multiple JVMS my single ton class will have multiple instances at each JVM. I will have to generate a Unique ID for this purpose i have to use a singleton pattern class. We can use a central place (like database) to generate the ids. Of course you need to do appropriate locking on the resource so that it is modified by only one entity at a time.

Another Solution would be to use Spring GemFire approach or to use Java NIO package for more fine grained approach.

Singleton pattern is a design solution where an application wants to have one and only one instance of any class, in all possible scenarios without any exceptional condition. It has been debated long enough in java community regarding possible approaches to make any class singleton. Still, you will find people not satisfied with any solution you give. They can not be overruled either. In this post, we will discuss some good approaches and will work towards our best possible effort.

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟