Skip to content

Commit

Permalink
Only initialize gateway server when the tool is actually used.
Browse files Browse the repository at this point in the history
Otherwise, the server is started for any itools command, and never shutdown,
causing the command to block at the end of the execution.
  • Loading branch information
sylvlecl committed Oct 11, 2018
1 parent 6ecb91a commit 75e3629
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py-powsybl/src/main/java/com/powsybl/powsybl/PyPowsybl.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
@AutoService(Tool.class)
public class PyPowsybl implements Tool {

final GatewayServer server = new GatewayServer();

@Override
public Command getCommand() {
return new Command() {
Expand Down Expand Up @@ -58,6 +56,8 @@ public String getUsageFooter() {
@Override
public void run(CommandLine line, ToolRunningContext context) throws Exception {

GatewayServer server = new GatewayServer();

Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
System.out.println();
Expand Down

0 comments on commit 75e3629

Please sign in to comment.