File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
rxjava-core/src/main/java/rx Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 21
21
import java .util .Arrays ;
22
22
import java .util .Comparator ;
23
23
import java .util .List ;
24
+ import java .util .concurrent .ConcurrentHashMap ;
24
25
import java .util .concurrent .Future ;
25
26
import java .util .concurrent .TimeUnit ;
26
27
128
129
*/
129
130
public class Observable <T > {
130
131
132
+ private final static ConcurrentHashMap <Class , Boolean > internalClassMap = new ConcurrentHashMap <Class , Boolean >();
133
+
131
134
/**
132
135
* Executed when 'subscribe' is invoked.
133
136
*/
@@ -4522,11 +4525,21 @@ private boolean isInternalImplementation(Object o) {
4522
4525
return true ;
4523
4526
}
4524
4527
// prevent double-wrapping (yeah it happens)
4525
- if (o instanceof SafeObserver )
4528
+ if (o instanceof SafeObserver ) {
4526
4529
return true ;
4527
- // we treat the following package as "internal" and don't wrap it
4528
- Package p = o .getClass ().getPackage (); // it can be null
4529
- return p != null && p .getName ().startsWith ("rx.operators" );
4530
+ }
4531
+
4532
+ Class <?> clazz = o .getClass ();
4533
+ if (internalClassMap .containsKey (clazz )) {
4534
+ //don't need to do reflection
4535
+ return internalClassMap .get (clazz );
4536
+ } else {
4537
+ // we treat the following package as "internal" and don't wrap it
4538
+ Package p = o .getClass ().getPackage (); // it can be null
4539
+ Boolean isInternal = (p != null && p .getName ().startsWith ("rx.operators" ));
4540
+ internalClassMap .put (clazz , isInternal );
4541
+ return isInternal ;
4542
+ }
4530
4543
}
4531
4544
4532
4545
}
You can’t perform that action at this time.
0 commit comments