prevent creating instance of singleton from thread

Solutions on MaxInterview for prevent creating instance of singleton from thread by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "prevent creating instance of singleton from thread"
Geraldine
16 Aug 2018
1// for java
2// ** use 'synchronized' keyword in function declaration
3
4public static synchronized Database getInstance(){...}
5
similar questions