|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--zinger.util.recycling.ObjectRecycler | +--zinger.util.recycling.CappedObjectRecycler
Performs the same task as its superclass, but allows the ability to specify the maximum number of cached instances. Useful when we know the approximate range of usage and don't want too many objects sitting cached in memory indefinitely after a surge.
Field Summary | |
protected int |
cap
|
Fields inherited from class zinger.util.recycling.ObjectRecycler |
generator, instances |
Constructor Summary | |
CappedObjectRecycler(ObjectGenerator generator,
int cap)
|
Method Summary | |
boolean |
recycleObject(java.lang.Object obj)
Puts obj into the cache. |
Methods inherited from class zinger.util.recycling.ObjectRecycler |
clearCache, getObject, getObject, instantiate |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected final int cap
Constructor Detail |
public CappedObjectRecycler(ObjectGenerator generator, int cap)
Method Detail |
public boolean recycleObject(java.lang.Object obj)
ObjectRecycler
obj
into the cache. It is the user's responsibility to make sure only
the objects that were generated this instance are returned. If getObject
method encounters a bad instance from the cache, it will discard it and go on to the next one.recycleObject
in class ObjectRecycler
zinger.util.recycling.ObjectRecycler
ObjectRecycler.getObject(java.lang.Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |