File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
ReactAndroid/src/main/java/com/facebook/react/bridge Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1111
1212import javax .annotation .Nullable ;
1313
14- import android .support .v4 .util .Pools ;
14+ import android .support .v4 .util .Pools . SimplePool ;
1515
1616/**
1717 * Implementation of Dynamic wrapping a ReadableMap.
1818 */
1919public class DynamicFromMap implements Dynamic {
20- private static final Pools .SimplePool <DynamicFromMap > sPool = new Pools .SimplePool <>(10 );
20+ private static final ThreadLocal <SimplePool <DynamicFromMap >> sPool = new ThreadLocal <SimplePool <DynamicFromMap >>() {
21+ @ Override
22+ protected SimplePool <DynamicFromMap > initialValue () {
23+ return new SimplePool <>(10 );
24+ }
25+ };
2126
2227 private @ Nullable ReadableMap mMap ;
2328 private @ Nullable String mName ;
@@ -26,7 +31,7 @@ public class DynamicFromMap implements Dynamic {
2631 private DynamicFromMap () {}
2732
2833 public static DynamicFromMap create (ReadableMap map , String name ) {
29- DynamicFromMap dynamic = sPool .acquire ();
34+ DynamicFromMap dynamic = sPool .get (). acquire ();
3035 if (dynamic == null ) {
3136 dynamic = new DynamicFromMap ();
3237 }
@@ -39,7 +44,7 @@ public static DynamicFromMap create(ReadableMap map, String name) {
3944 public void recycle () {
4045 mMap = null ;
4146 mName = null ;
42- sPool .release (this );
47+ sPool .get (). release (this );
4348 }
4449
4550 @ Override
You can’t perform that action at this time.
0 commit comments