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

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -