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
129
130
*/
130
131
public class Observable <T > {
131
132
133
+ private final static ConcurrentHashMap <Class , Boolean > internalClassMap = new ConcurrentHashMap <Class , Boolean >();
134
+
132
135
/**
133
136
* Executed when 'subscribe' is invoked.
134
137
*/
@@ -4545,11 +4548,21 @@ private boolean isInternalImplementation(Object o) {
4545
4548
return true ;
4546
4549
}
4547
4550
// prevent double-wrapping (yeah it happens)
4548
- if (o instanceof SafeObserver )
4551
+ if (o instanceof SafeObserver ) {
4549
4552
return true ;
4550
- // we treat the following package as "internal" and don't wrap it
4551
- Package p = o .getClass ().getPackage (); // it can be null
4552
- return p != null && p .getName ().startsWith ("rx.operators" );
4553
+ }
4554
+
4555
+ Class <?> clazz = o .getClass ();
4556
+ if (internalClassMap .containsKey (clazz )) {
4557
+ //don't need to do reflection
4558
+ return internalClassMap .get (clazz );
4559
+ } else {
4560
+ // we treat the following package as "internal" and don't wrap it
4561
+ Package p = o .getClass ().getPackage (); // it can be null
4562
+ Boolean isInternal = (p != null && p .getName ().startsWith ("rx.operators" ));
4563
+ internalClassMap .put (clazz , isInternal );
4564
+ return isInternal ;
4565
+ }
4553
4566
}
4554
4567
4555
4568
}
You can’t perform that action at this time.
0 commit comments