Singleton Design pattern in Java | Best Practice | Java Techie
HTML-код
- Опубликовано: 21 ноя 2018
- This video will explain
#JavaTechie #Singleton #DesignPattern
What is singleton-design-pattern ?
How many way we can create a class as singleton ?
Advantages and disadvantages of each approach ?
Best Practice to create singleton class
GitHub:
github.com/Java-Techie-jt/sin...
Blogs:
javagyanmantra.wixsite.com/we...
Facebook:
/ 919464521471923
Like and subscribe Наука
Easiest, Bestest, Simplest possible way to explain every scenario. This clears every little doubt of singleton class creation. Thanks a ton buddy 💫
Great explanation ..deserves lots of appreciation !! Thanks bhai.
Nice
Waiting for next video
I haven't seen this type of explanation with implementation examples on RUclips yet. Thanks a lot Java Techie!!
It is a very humble request from my side that if you could create a playlist on few most asked Design patterns like Factory, Adapter, Observer, Builder etc.
Thanks in advance!!
Sure will do that buddy
@@Javatechie ya please do. superb explanation.
@@Javatechie Hi can you please let me know if you are planning on design pattern playlist?? Waiting for it from quite long time
Excellent
Nice Explanation.. if possible plese pull some more very useful design pattern for improving coding skill.
Thank you...
double-checked locking performs the synchronization only when the Singleton instance is first created. It first checks if an instance is already created and if not, then it synchronizes. This means the synchronized block is executed only once, reducing the overhead of unnecessary synchronization after the instance is already initialized.
Thank you .
Please do the videos for remaining design patterns also,thank you
Tq.. Please tell what are design patterns use in regular development...
If possible please give example in real time scenario where we will use in the project...
Hi sir.. May i know the exact use cases of Multithread.. Point.. I need real time scenario.. Please cover if possible..
We know only to make method non.. Synchronized.... It's information.. But ned to example with real time use cases.. Please.. Thanks
Hello Sir,please create playlist on design patterns,I am eagerly looking for same ,I checking various platforms but haven't find any.thanks.
I will
wow, nice explanation. can you please tell me what is race condition briefly
Race condition occurs when multiple thread trying to update the object at the same time .
@@sarojsahoo8763 Thank you
Can u explain the double check little brief . I want to understand the outside if necessity in singleton
Ok I will
Hi, how are you saying the static inner class way of creating singleton is thread-safe?
Am not only saying dude , please go through proof of concept , try to access same with multiple thread and check the hardcode of instance generated by two thread
@java techie Any video on factory design pattern
Not yet uploaded but i will do that
why Bill Pugh Singleton Implementation doesn’t require synchronization?
What I understood is In case of Bill Pugh Singleton design principle Always when getinstance method will be called object will gets created which is a static variable and I think static will share the single copy of the object in case of multiple thread access also.
Where do we have used in our project what u need to say except HibernateUtil.
People used it multiple scenario .
In hibernate util also it's not required if you are using spring
@@Javatechie Could you explain some scenarios
some one please clarify my doubt☹️..
Private method means we can't access from outside of the class right.... But how he is calling private method from App class. How it works..
Check access modifier am not calling private method , it's static factory method
I didn't understand why using synchronised
8.52,u said 2 threads will create 2 objects ,thats not correct. As the method is synchronized ,so no 2 threads can enter simultaneously.
You didn't get it properly . If you won't make it thread safe then it could be possible that 2 threads can enter at a time if there is a context switching happening .
@@Javatechie MySimple Question = Can two threads be inside synchronized method ?
No not possible directly
@@saumitrasaxena8470 @Javatechie The idea behind further going to doubleChecking from synchronized must be the performance optimization and not the Multithreading issue.
So, inside synchronized method, two thread can't enter. Using synchronized method or using double checking way, both will avoid multi-instance creation. Performance wise - double checking way is better.
Why there is not quality available for video
It's available on 1080 HD brother
@@Javatechie for this video in quality option it is sawing unavailable on RUclips app
For me it's showing 720p max and buddy this was too old video so I was not aware about editing so please cooperate and keep learning 😃
@@Javatechie yes it's to old but giving lot of knowledge thanks 👍