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
  • НаукаНаука

Комментарии • 45

  • @ashishpal5446
    @ashishpal5446 2 года назад +1

    Easiest, Bestest, Simplest possible way to explain every scenario. This clears every little doubt of singleton class creation. Thanks a ton buddy 💫

  • @tarun.realscorp
    @tarun.realscorp 3 года назад +1

    Great explanation ..deserves lots of appreciation !! Thanks bhai.

  • @nagarjunareddykanala9318
    @nagarjunareddykanala9318 5 лет назад +1

    Nice
    Waiting for next video

  • @vibhore48
    @vibhore48 2 года назад +4

    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!!

    • @Javatechie
      @Javatechie  2 года назад

      Sure will do that buddy

    • @sagarbathini241
      @sagarbathini241 2 года назад

      @@Javatechie ya please do. superb explanation.

    • @saumyasethiya-ft8qj
      @saumyasethiya-ft8qj Год назад

      @@Javatechie Hi can you please let me know if you are planning on design pattern playlist?? Waiting for it from quite long time

  • @tulasiramsunkara
    @tulasiramsunkara 2 года назад +1

    Excellent

  • @deepakmahato3793
    @deepakmahato3793 5 лет назад +1

    Nice Explanation.. if possible plese pull some more very useful design pattern for improving coding skill.
    Thank you...

  • @AyushGupta-ib5qk
    @AyushGupta-ib5qk 2 месяца назад

    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.

  • @tussharsurya5829
    @tussharsurya5829 5 лет назад +1

    Thank you .

  • @sujatamishra8155
    @sujatamishra8155 Год назад

    Please do the videos for remaining design patterns also,thank you

  • @rameshchowdarykonka5551
    @rameshchowdarykonka5551 5 лет назад +1

    Tq.. Please tell what are design patterns use in regular development...

  • @adi36908
    @adi36908 Месяц назад

    If possible please give example in real time scenario where we will use in the project...

  • @tejabtitare5169
    @tejabtitare5169 2 года назад +1

    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

  • @shitalkarande1753
    @shitalkarande1753 4 года назад +4

    Hello Sir,please create playlist on design patterns,I am eagerly looking for same ,I checking various platforms but haven't find any.thanks.

  • @madhavkadiyala7494
    @madhavkadiyala7494 5 лет назад +1

    wow, nice explanation. can you please tell me what is race condition briefly

    • @sarojsahoo8763
      @sarojsahoo8763 5 лет назад

      Race condition occurs when multiple thread trying to update the object at the same time .

    • @madhavkadiyala7494
      @madhavkadiyala7494 5 лет назад

      @@sarojsahoo8763 Thank you

  • @sarojsahoo8763
    @sarojsahoo8763 5 лет назад +1

    Can u explain the double check little brief . I want to understand the outside if necessity in singleton

  • @palaniappanrm6277
    @palaniappanrm6277 4 года назад +1

    Hi, how are you saying the static inner class way of creating singleton is thread-safe?

    • @Javatechie
      @Javatechie  4 года назад +1

      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

  • @prathyushabhavanasi8121
    @prathyushabhavanasi8121 Год назад +1

    @java techie Any video on factory design pattern

    • @Javatechie
      @Javatechie  Год назад +1

      Not yet uploaded but i will do that

  • @shreyanshjain2347
    @shreyanshjain2347 5 лет назад +1

    why Bill Pugh Singleton Implementation doesn’t require synchronization?

    • @sarojsahoo8763
      @sarojsahoo8763 5 лет назад +1

      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.

  • @sarojsahoo8763
    @sarojsahoo8763 5 лет назад +1

    Where do we have used in our project what u need to say except HibernateUtil.

    • @Javatechie
      @Javatechie  5 лет назад +1

      People used it multiple scenario .
      In hibernate util also it's not required if you are using spring

    • @sarojsahoo8763
      @sarojsahoo8763 5 лет назад

      @@Javatechie Could you explain some scenarios

  • @srinath710
    @srinath710 3 года назад +1

    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..

    • @Javatechie
      @Javatechie  3 года назад

      Check access modifier am not calling private method , it's static factory method

  • @udaybhaskar4940
    @udaybhaskar4940 9 месяцев назад

    I didn't understand why using synchronised

  • @saumitrasaxena8470
    @saumitrasaxena8470 Год назад +2

    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.

    • @Javatechie
      @Javatechie  Год назад

      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 .

    • @saumitrasaxena8470
      @saumitrasaxena8470 Год назад +1

      @@Javatechie MySimple Question = Can two threads be inside synchronized method ?

    • @Javatechie
      @Javatechie  Год назад

      No not possible directly

    • @ravisundriyal1
      @ravisundriyal1 Год назад +1

      ​@@saumitrasaxena8470 @Javatechie The idea behind further going to doubleChecking from synchronized must be the performance optimization and not the Multithreading issue.

    • @PkSam07
      @PkSam07 10 месяцев назад

      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.

  • @girishchaudhari4668
    @girishchaudhari4668 6 месяцев назад +1

    Why there is not quality available for video

    • @Javatechie
      @Javatechie  6 месяцев назад

      It's available on 1080 HD brother

    • @girishchaudhari4668
      @girishchaudhari4668 6 месяцев назад

      @@Javatechie for this video in quality option it is sawing unavailable on RUclips app

    • @Javatechie
      @Javatechie  6 месяцев назад

      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 😃

    • @girishchaudhari4668
      @girishchaudhari4668 6 месяцев назад +1

      @@Javatechie yes it's to old but giving lot of knowledge thanks 👍