| Package | com.elad.framework.objectPoolManager |
| Class | public class ReusablePool |
The object pooling can boost performance; especially in cases where the resources used to initializing a class instance are high, the number of times the class will be usage is often, and the number of instantiations in use at any single time is low.
var reusable:Reusable = new Reusable();
reusable.name = "FlexImage";
reusable.object = new UIComponent();
reusablePool.setReusable(reusable);
| Property | Defined by | ||
|---|---|---|---|
| reusable : Reusable
[static]
Temporary place holder for a reusable object.
| ReusablePool | ||
| Method | Defined by | ||
|---|---|---|---|
|
ReusablePool(enforcer:AccessRestriction)
Internal constructor.
| ReusablePool | ||
|
acquireReusable(name:String):Reusable
Class acquireReusable is called when it client need a Reusable object
The reusable object is cleared until the client return the object
back to the pool via the releaseReusable method.
| ReusablePool | ||
|
[static]
Method function to retrieve instance of object ReusablePool
| ReusablePool | ||
|
releaseReusable(releasedReusable:Reusable):void
Method will be used to release Reusable collection once the client finished using it.
| ReusablePool | ||
|
setMaxPoolSize(size:Number):void
Method to set the size of the collection.
| ReusablePool | ||
|
setReusable(reusable:Reusable):void
Method to add an object to the collection the collection, as long as the collection size is smaller than the max allowed pool.
| ReusablePool | ||
| reusable | property |
protected static var reusable:ReusableTemporary place holder for a reusable object.
| ReusablePool | () | constructor |
public function ReusablePool(enforcer:AccessRestriction)Internal constructor. Should not be called from outside this class.
Parametersenforcer:AccessRestriction — Object accessible to just this class to enforce
singleton pattern.
|
| acquireReusable | () | method |
public function acquireReusable(name:String):ReusableClass acquireReusable is called when it client need a Reusable object The reusable object is cleared until the client return the object back to the pool via the releaseReusable method.
Parametersname:String — The name of the reusable object.
|
Reusable —
Reusable class which holds the name and the object.
|
| getInstance | () | method |
public static function getInstance():ReusablePoolMethod function to retrieve instance of object ReusablePool
ReturnsReusablePool —
ReusablePool Instance
|
| releaseReusable | () | method |
public function releaseReusable(releasedReusable:Reusable):voidMethod will be used to release Reusable collection once the client finished using it.
ParametersreleasedReusable:Reusable — type Reusable class and holds the name and object to be returned to the collection.
|
| setMaxPoolSize | () | method |
public function setMaxPoolSize(size:Number):voidMethod to set the size of the collection. If the collection reaches the max allowed object the class will return an error message.
Parameterssize:Number — The size of the collection.
|
| setReusable | () | method |
public function setReusable(reusable:Reusable):voidMethod to add an object to the collection the collection, as long as the collection size is smaller than the max allowed pool.
Parametersreusable:Reusable — type Reusable which holds the name and the object.
|