-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GrpcServiceBridgeImpl handle HttpClosedException
fixes #101
- Loading branch information
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
vertx-grpc-server/src/test/java/io/vertx/grpc/server/ProcessHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.vertx.grpc.server; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class ProcessHelper { | ||
|
||
private ProcessHelper() {} | ||
|
||
public static Process exec(Class<?> main, List<String> args) throws IOException { | ||
|
||
List<String> command = new ArrayList<>(); | ||
// java binary executable | ||
command.add(System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"); | ||
command.add("-cp"); | ||
// inherit classpath | ||
command.add(System.getProperty("java.class.path")); | ||
// main class name | ||
command.add(main.getName()); | ||
// args | ||
command.addAll(Objects.requireNonNullElse(args, Collections.emptyList())); | ||
|
||
return new ProcessBuilder(command).inheritIO().start(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters