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
Post a Comment