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 99
1010import javax .annotation .Nullable ;
1111
12- import android .support .v4 .util .Pools ;
12+ import android .support .v4 .util .Pools . SimplePool ;
1313
1414/**
1515 * Implementation of Dynamic wrapping a ReadableMap.
1616 */
1717public class DynamicFromMap implements Dynamic {
18- private static final Pools .SimplePool <DynamicFromMap > sPool = new Pools .SimplePool <>(10 );
18+ private static final ThreadLocal <SimplePool <DynamicFromMap >> sPool = new ThreadLocal <SimplePool <DynamicFromMap >>() {
19+ @ Override
20+ protected SimplePool <DynamicFromMap > initialValue () {
21+ return new SimplePool <>(10 );
22+ }
23+ };
1924
2025 private @ Nullable ReadableMap mMap ;
2126 private @ Nullable String mName ;
@@ -24,7 +29,7 @@ public class DynamicFromMap implements Dynamic {
2429 private DynamicFromMap () {}
2530
2631 public static DynamicFromMap create (ReadableMap map , String name ) {
27- DynamicFromMap dynamic = sPool .acquire ();
32+ DynamicFromMap dynamic = sPool .get (). acquire ();
2833 if (dynamic == null ) {
2934 dynamic = new DynamicFromMap ();
3035 }
@@ -37,7 +42,7 @@ public static DynamicFromMap create(ReadableMap map, String name) {
3742 public void recycle () {
3843 mMap = null ;
3944 mName = null ;
40- sPool .release (this );
45+ sPool .get (). release (this );
4146 }
4247
4348 @ Override
You can’t perform that action at this time.
0 commit comments