Server restart & custom Java runner

In a plugin, I have my own implementation of application runner, and the main point is to set custom VM argumetns depending on the plugin/environment settings:

public class MyRunner extends DefaultJavaProgramRunner {


     @Override
    public void patch(JavaParameters javaParameters, RunnerSettings runnerSettings, boolean beforeExecution) throws ExecutionException {
        super.patch(javaParameters, runnerSettings, beforeExecution);
        _patch(javaParameters, runnerSettings); // custom logic to set the VM arguments
    }

}

It works find for any Java process or application server. Though I have an issue with server restart functionality. Whenever a server is runnig (say, Tomcat) and the user presses the launch button again, a dialog is popped up saying that the server is actually running and then the user can choose, either to update the resources, redeploy, or _restart_ the container. If the user decides to restart, the custom login for VM arguments isn't applied anymore, which is the problem.

tomcat-restart-intellj.png

The problem is minor, but annoying and I'd like to fix it.  However, I couldn't find this part in the sources as server connectors are most likely not a part of the Community Edition.

Any tips on how to resolve this are appreciated.

2 comments
Comment actions Permalink

It's strange because 'Restart Server' option uses ProgramRunnerUtil#executeConfiguration method to start the server. The same method is used when a
run configuration is started using 'Run' button.

BTW if you want to patch VM parameters of java-based run configurations it would be better to provide JavaProgramPatcher extension instead of new
ProgramRunner implementation.

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Yes, I was thinking about moving the logic to a custom JavaProgramPatcher, but is there a way to get an instance of RunnerSettings in the patcher? (otherwise it is just too much code to rewrite for me)

0

Please sign in to leave a comment.