Package com.prineside.tdi2.utils
Class SafePools
java.lang.Object
com.prineside.tdi2.utils.SafePools
Thread-safe version of GDX's Pools
 Why thread safe:
 - Some events (like LogEntryAdd) may be triggered on a different threads
 - Multiple gameStates can be simulated on a different threads at the same time
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic interfacestatic final classstatic class - 
Method Summary
Modifier and TypeMethodDescription<T> SafePools.Pool<T>create(int initial, int max, ObjectSupplier<T> provider) voidFrees an object from thepool.voidFrees the specified objects from thepool.voidFrees the specified objects from thepool.<T> SafePools.Pool<T>Returns a new or existing pool for the specified type, stored in a Class toSafePools.Poolmap.<T> SafePools.Pool<T>static SafePools<T> TObtains an object from thepool.<T> voidset(Class<T> type, SafePools.Pool<T> pool) Sets an existing pool for the specified type, stored in a Class toSafePools.Poolmap. 
- 
Method Details
- 
getInstance
 - 
create
- Returns:
 - RegularPool or a simple instantiator depending on the Engine's config
 
 - 
get
 - 
get
Returns a new or existing pool for the specified type, stored in a Class toSafePools.Poolmap. The max size of the pool used is 100. - 
set
Sets an existing pool for the specified type, stored in a Class toSafePools.Poolmap. - 
obtain
Obtains an object from thepool. - 
free
Frees an object from thepool. - 
freeAll
Frees the specified objects from thepool. Null objects within the array are silently ignored. Objects don't need to be from the same pool. - 
freeAll
Frees the specified objects from thepool. Null objects within the array are silently ignored.- Parameters:
 samePool- If true, objects don't need to be from the same pool but the pool must be looked up for each object.
 
 -