Java creating max 3 objects of a class -


when want create 1 object of class, use singleton design pattern. want create maximum 3 or 5 objects of class. there way restrict maximum number of object creation in java?

of course implement singleton-like feature rather easily, you're apparently looking object pool.

there many implementations of such pools, notable 1 apache commons/pool


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

visual studio - Deleting lines of code in a text editor -

What's the encoding type of Android 2.2 push message? -