5
5
import java .util .stream .Stream ;
6
6
7
7
public class LoadTest {
8
+
8
9
public static void main (String [] args ) {
9
10
Service service1 = new Service1 ("Service1" );
10
11
Service service1_1 = new Service1 ("Service1_1" );
@@ -16,26 +17,26 @@ public static void main(String[] args) {
16
17
Handler2 handler2_1 = new Handler2 (service1 );
17
18
Handler2 handler2_2 = new Handler2 (service2 );
18
19
19
- System .out .println ("Interface:" + Arrays .equals (Service1 .class .getInterfaces (), Service2 .class .getInterfaces ()));
20
- System .out .println ("ClassLoader:" + Service1 .class .getClassLoader ().equals (Service2 .class .getClassLoader ()));
20
+ System .out .println ("Interface:" + Arrays .equals (Service1 .class .getInterfaces (), Service2 .class .getInterfaces ()));
21
+ System .out .println ("ClassLoader:" + Service1 .class .getClassLoader ().equals (Service2 .class .getClassLoader ()));
21
22
22
23
Service impl1_1_1 = (Service ) Proxy .newProxyInstance (Service1 .class .getClassLoader (), Service1 .class .getInterfaces (), handler1_1 );
23
24
Service impl1_1_2 = (Service ) Proxy .newProxyInstance (Service1 .class .getClassLoader (), Service1 .class .getInterfaces (), handler1_1 );
24
- System .out .println ("重复生成:" + impl1_1_1 .getClass ().equals (impl1_1_2 .getClass ()));
25
+ System .out .println ("重复生成:" + impl1_1_1 .getClass ().equals (impl1_1_2 .getClass ()));
25
26
26
27
Service impl1_1_1_1 = (Service ) Proxy .newProxyInstance (Service1 .class .getClassLoader (), Service1 .class .getInterfaces (), handler1_1_1 );
27
- System .out .println ("同handler类不同handler的对象:" + impl1_1_1 .getClass ().equals (impl1_1_1_1 .getClass ()));
28
+ System .out .println ("同handler类不同handler的对象:" + impl1_1_1 .getClass ().equals (impl1_1_1_1 .getClass ()));
28
29
29
30
Service impl1_2_1 = (Service ) Proxy .newProxyInstance (Service2 .class .getClassLoader (), Service2 .class .getInterfaces (), handler1_2 );
30
- System .out .println ("同handler类不同handler、target类:" + impl1_1_1 .getClass ().equals (impl1_2_1 .getClass ()));
31
+ System .out .println ("同handler类不同handler、target类:" + impl1_1_1 .getClass ().equals (impl1_2_1 .getClass ()));
31
32
32
33
Service impl2_1_1 = (Service ) Proxy .newProxyInstance (Service1 .class .getClassLoader (), Service1 .class .getInterfaces (), handler2_1 );
33
- System .out .println ("不同handler类:" + impl1_1_1 .getClass ().equals (impl2_1_1 .getClass ()));
34
+ System .out .println ("不同handler类:" + impl1_1_1 .getClass ().equals (impl2_1_1 .getClass ()));
34
35
35
36
Service impl2_2_1 = (Service ) Proxy .newProxyInstance (Service2 .class .getClassLoader (), Service2 .class .getInterfaces (), handler2_2 );
36
- System .out .println ("不同handler、target类:" + impl1_1_1 .getClass ().equals (impl2_2_1 .getClass ()));
37
+ System .out .println ("不同handler、target类:" + impl1_1_1 .getClass ().equals (impl2_2_1 .getClass ()));
37
38
38
- System .out .println (impl1_1_1 .getClass ()+ "--" + impl2_2_1 .getClass ());
39
+ System .out .println (impl1_1_1 .getClass () + "--" + impl2_2_1 .getClass ());
39
40
40
41
System .out .println ("StackTrace:" );
41
42
impl2_2_1 .print ();
@@ -50,7 +51,7 @@ public static void main(String[] args) {
50
51
Stream .of (clazz .getDeclaredFields ()).forEach (field -> {
51
52
field .setAccessible (true );
52
53
try {
53
- System .out .println (field + ":" + field .get (impl1_1_1 ));
54
+ System .out .println (field + ":" + field .get (impl1_1_1 ));
54
55
} catch (IllegalAccessException e ) {
55
56
System .out .println (field );
56
57
}
@@ -59,7 +60,7 @@ public static void main(String[] args) {
59
60
Stream .of (clazz .getFields ()).forEach (field -> {
60
61
field .setAccessible (true );
61
62
try {
62
- System .out .println (field + ":" + field .get (impl1_1_1 ));
63
+ System .out .println (field + ":" + field .get (impl1_1_1 ));
63
64
} catch (IllegalAccessException e ) {
64
65
System .out .println (field );
65
66
}
0 commit comments