File tree 8 files changed +28
-16
lines changed
src/main/java/io/goudai/cluster/util
src/main/java/io/goudai/commons/pool/impl
gd-rpc/src/main/java/io/goudai/rpc/invoker
8 files changed +28
-16
lines changed Original file line number Diff line number Diff line change 46
46
<version >1.2.17</version >
47
47
</dependency >
48
48
49
+
49
50
</dependencies >
50
51
51
52
</project >
Original file line number Diff line number Diff line change 10
10
public class MethodUtil {
11
11
12
12
13
-
14
13
public static Set <String > getMethods (String interfaceName ) throws ClassNotFoundException {
15
- Set <String > methods = new HashSet <>();
16
- Arrays .asList (Class .forName (interfaceName ).getMethods ()).forEach (method -> methods .add (method .getName ()));
17
- return methods ;
14
+ return getMethods (Class .forName (interfaceName ));
18
15
}
19
16
20
17
public static Set <String > getMethods (Class <?> interfaceClass ) {
21
18
Set <String > methods = new HashSet <>();
22
- Arrays .asList (interfaceClass .getMethods ()).forEach ( method -> methods . add ( method . getName ()));
19
+ Arrays .asList (interfaceClass .getMethods ()).stream (). map ( m -> m . getName ()). forEach ( methods :: add );
23
20
return methods ;
24
21
}
25
22
}
Original file line number Diff line number Diff line change 19
19
20
20
<dependencies >
21
21
<dependency >
22
- <groupId >junit</groupId >
23
- <artifactId >junit</artifactId >
24
- <version >3.8.1</version >
25
- <scope >test</scope >
22
+ <groupId >org.apache.commons</groupId >
23
+ <artifactId >commons-pool2</artifactId >
26
24
</dependency >
27
25
</dependencies >
28
26
</project >
Original file line number Diff line number Diff line change 8
8
/**
9
9
* Created by freeman on 2016/1/30.
10
10
*/
11
- public class Commons2Pool <T > implements Pool <T > {
11
+ public class CommonsPool2Impl <T > implements Pool <T > {
12
12
private GenericObjectPool <T > pool ;
13
13
private GenericObjectPoolConfig config ;
14
14
private PooledObjectFactory <T > factory ;
15
15
16
16
17
- public Commons2Pool (GenericObjectPoolConfig config , PooledObjectFactory <T > factory ) {
17
+ public CommonsPool2Impl (GenericObjectPoolConfig config , PooledObjectFactory <T > factory ) {
18
18
this .pool = new GenericObjectPool <T >(factory , config );
19
19
this .factory = factory ;
20
20
this .config = config ;
@@ -34,4 +34,8 @@ public void returnObject(T o) {
34
34
public void destroy () {
35
35
this .pool .close ();
36
36
}
37
+
38
+ public static void main (String [] args ) {
39
+ final CommonsPool2Impl <Object > objectCommonsPool2 = new CommonsPool2Impl <>(null ,null );
40
+ }
37
41
}
Original file line number Diff line number Diff line change 29
29
<artifactId >gd-commons</artifactId >
30
30
<version >1.0-SNAPSHOT</version >
31
31
</dependency >
32
+ <dependency >
33
+ <groupId >org.slf4j</groupId >
34
+ <artifactId >slf4j-api</artifactId >
35
+ </dependency >
36
+ <dependency >
37
+ <groupId >org.projectlombok</groupId >
38
+ <artifactId >lombok</artifactId >
39
+ </dependency >
32
40
33
41
</dependencies >
34
42
</project >
Original file line number Diff line number Diff line change 33
33
<artifactId >gd-commons</artifactId >
34
34
<version >1.0-SNAPSHOT</version >
35
35
</dependency >
36
+ <dependency >
37
+ <groupId >org.projectlombok</groupId >
38
+ <artifactId >lombok</artifactId >
39
+ </dependency >
36
40
<dependency >
37
41
<groupId >junit</groupId >
38
42
<artifactId >junit</artifactId >
Original file line number Diff line number Diff line change 1
1
package io .goudai .rpc .invoker ;
2
2
3
3
import io .goudai .commons .pool .Pool ;
4
- import io .goudai .commons .pool .impl .Commons2Pool ;
4
+ import io .goudai .commons .pool .impl .CommonsPool2Impl ;
5
5
import io .goudai .rpc .exception .RpcException ;
6
6
import io .goudai .rpc .model .Request ;
7
7
import io .goudai .rpc .model .Response ;
@@ -21,12 +21,12 @@ public SingleInvoker(PooledObjectFactory<RequestSession> objectFactory) {
21
21
config .setMaxIdle (100 );
22
22
config .setMaxTotal (100 );
23
23
// config.setTestOnReturn(true);
24
- this .requestSessionPool = new Commons2Pool <>(config , objectFactory );
24
+ this .requestSessionPool = new CommonsPool2Impl <>(config , objectFactory );
25
25
}
26
26
27
27
public SingleInvoker (PooledObjectFactory <RequestSession > objectFactory , GenericObjectPoolConfig config ) {
28
28
config .setTestOnReturn (true );
29
- this .requestSessionPool = new Commons2Pool <>(config , objectFactory );
29
+ this .requestSessionPool = new CommonsPool2Impl <>(config , objectFactory );
30
30
}
31
31
32
32
Original file line number Diff line number Diff line change 23
23
<properties >
24
24
<project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
25
25
</properties >
26
-
26
+ < dependencyManagement >
27
27
<dependencies >
28
28
<dependency >
29
29
<groupId >org.slf4j</groupId >
53
53
</dependency >
54
54
55
55
</dependencies >
56
-
56
+ </ dependencyManagement >
57
57
<build >
58
58
<plugins >
59
59
<plugin >
You can’t perform that action at this time.
0 commit comments