performance between Singleton and non singleton
Posted on 2010-09-13
I have a Java class which handles persistence of my application. I would like to each end user use this persistence later. Inside persistence layer, there is some shared resources.
1) One solution is that use persistence all the way as singleton among multiple user.
2) The other way, every one holds a persistence object, in shared place, I use synchronized method.
Which one has better performance? In my mind, method 2) would have high performance. Any suggestions?