Skip to content

Commit b378529

Browse files
committed
update grpc cs
1 parent 0adee32 commit b378529

File tree

4 files changed

+57
-18
lines changed

4 files changed

+57
-18
lines changed

jdk_8_maven/cs/rpc/grpc/artificial/grpc-ncs/pom.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,24 @@
6767
</execution>
6868
</executions>
6969
</plugin>
70+
71+
<plugin>
72+
<groupId>org.springframework.boot</groupId>
73+
<artifactId>spring-boot-maven-plugin</artifactId>
74+
<executions>
75+
<execution>
76+
<goals>
77+
<goal>repackage</goal>
78+
</goals>
79+
<configuration>
80+
<finalName>rpc-grpc-ncs</finalName>
81+
<classifier>sut</classifier>
82+
</configuration>
83+
</execution>
84+
</executions>
85+
</plugin>
86+
7087
</plugins>
7188
</build>
7289

73-
</project>
90+
</project>

jdk_8_maven/cs/rpc/grpc/artificial/grpc-ncs/src/main/java/org/grpc/ncs/NcsServer.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
*/
1616
public class NcsServer {
1717

18-
// public static void main(String[] args) throws IOException, InterruptedException {
19-
// Server server = ServerBuilder.forPort(8080).addService(new NcsServiceImplBaseImpl()).build();
20-
// server.start();
21-
// server.awaitTermination();
22-
// }
23-
2418
private static final Logger logger = Logger.getLogger(NcsServer.class.getName());
2519

2620
private final int port;
@@ -38,7 +32,7 @@ public NcsServer(ServerBuilder<?> serverBuilder, int port) {
3832

3933
public void start() throws IOException {
4034
server.start();
41-
logger.info("Server started, listening on " + port);
35+
logger.info("NcsServer started, listening on " + port);
4236
Runtime.getRuntime().addShutdownHook(new Thread() {
4337
@Override
4438
public void run() {
@@ -66,7 +60,15 @@ void blockUntilShutdown() throws InterruptedException {
6660
}
6761

6862
public static void main(String[] args) throws Exception {
69-
NcsServer server = new NcsServer(8980);
63+
int sutPort = 8980;
64+
if (args.length == 1){
65+
try{
66+
sutPort = Integer.parseInt(args[0]);
67+
}catch (Exception NumberFormatException){
68+
69+
}
70+
}
71+
NcsServer server = new NcsServer(sutPort);
7072
server.start();
7173
server.blockUntilShutdown();
7274
}

jdk_8_maven/cs/rpc/grpc/artificial/grpc-scs/pom.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@
6666
</execution>
6767
</executions>
6868
</plugin>
69+
70+
71+
<plugin>
72+
<groupId>org.springframework.boot</groupId>
73+
<artifactId>spring-boot-maven-plugin</artifactId>
74+
<executions>
75+
<execution>
76+
<goals>
77+
<goal>repackage</goal>
78+
</goals>
79+
<configuration>
80+
<finalName>rpc-grpc-scs</finalName>
81+
<classifier>sut</classifier>
82+
</configuration>
83+
</execution>
84+
</executions>
85+
</plugin>
6986
</plugins>
7087
</build>
71-
</project>
88+
</project>

jdk_8_maven/cs/rpc/grpc/artificial/grpc-scs/src/main/java/org/grpc/scs/ScsServer.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
*/
1616
public class ScsServer {
1717

18-
// public static void main(String[] args) throws IOException, InterruptedException {
19-
// Server server = ServerBuilder.forPort(8080).addService(new NcsServiceImplBaseImpl()).build();
20-
// server.start();
21-
// server.awaitTermination();
22-
// }
23-
2418
private static final Logger logger = Logger.getLogger(ScsServer.class.getName());
2519

2620
private final int port;
@@ -38,7 +32,7 @@ public ScsServer(ServerBuilder<?> serverBuilder, int port) {
3832

3933
public void start() throws IOException {
4034
server.start();
41-
logger.info("Server started, listening on " + port);
35+
logger.info("ScsServer started, listening on " + port);
4236
Runtime.getRuntime().addShutdownHook(new Thread() {
4337
@Override
4438
public void run() {
@@ -66,7 +60,16 @@ void blockUntilShutdown() throws InterruptedException {
6660
}
6761

6862
public static void main(String[] args) throws Exception {
69-
ScsServer server = new ScsServer(8980);
63+
int sutPort = 8980;
64+
if (args.length == 1){
65+
try{
66+
sutPort = Integer.parseInt(args[0]);
67+
}catch (Exception NumberFormatException){
68+
69+
}
70+
}
71+
72+
ScsServer server = new ScsServer(sutPort);
7073
server.start();
7174
server.blockUntilShutdown();
7275
}

0 commit comments

Comments
 (0)