Search in sources :

Example 1 with PreStartClusterSequence

use of com.github.alexcojocaru.mojo.elasticsearch.v2.step.PreStartClusterSequence in project elasticsearch-maven-plugin by alexcojocaru.

the class RunForkedMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    if (skip) {
        getLog().info("Skipping plugin execution");
        return;
    }
    ClusterConfiguration clusterConfig = buildClusterConfiguration();
    new PreStartClusterSequence().execute(clusterConfig);
    for (InstanceConfiguration config : clusterConfig.getInstanceConfigurationList()) {
        getLog().info(String.format("Using Elasticsearch [%d] configuration: %s", config.getId(), config));
        try {
            ForkedInstance instance = new ForkedInstance(config);
            instance.configureInstance();
            Thread thread = new Thread(instance);
            thread.start();
            new PostStartInstanceSequence().execute(config);
        } catch (Exception e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }
    new PostStartClusterSequence().execute(clusterConfig);
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) PostStartClusterSequence(com.github.alexcojocaru.mojo.elasticsearch.v2.step.PostStartClusterSequence) PreStartClusterSequence(com.github.alexcojocaru.mojo.elasticsearch.v2.step.PreStartClusterSequence) PostStartInstanceSequence(com.github.alexcojocaru.mojo.elasticsearch.v2.step.PostStartInstanceSequence) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Aggregations

PostStartClusterSequence (com.github.alexcojocaru.mojo.elasticsearch.v2.step.PostStartClusterSequence)1 PostStartInstanceSequence (com.github.alexcojocaru.mojo.elasticsearch.v2.step.PostStartInstanceSequence)1 PreStartClusterSequence (com.github.alexcojocaru.mojo.elasticsearch.v2.step.PreStartClusterSequence)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1