Skip to content

Commit

Permalink
Add threadSafe attribute to @mojo annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
cherylking committed Jan 17, 2024
1 parent e5da4d7 commit 9389e2c
Show file tree
Hide file tree
Showing 25 changed files with 50 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ protected static void runProcess(String processCommand) throws IOException, Inte
writer = new BufferedWriter(new OutputStreamWriter(stdin));
// wait for process to finish max 20 seconds
process.waitFor(20, TimeUnit.SECONDS);
assertFalse(process.isAlive());
if (process.isAlive()) {
process.waitFor(20, TimeUnit.SECONDS);
}
assertFalse("The process for command "+command+" did not finish in 40 seconds.", process.isAlive());

// save and print process output
Path path = logFile.toPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* dependencies with scope compile + system + runtime.
* Provided scope transitive dependencies are not included by default (built-in maven behavior).
*/
@Mojo(name = "deploy", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "deploy", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class DeployMojo extends DeployMojoSupport {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2017, 2023.
* (C) Copyright IBM Corporation 2017, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@
/**
* Display an application URL in the default browser.
*/
@Mojo(name = "display-url")
@Mojo(name = "display-url", threadSafe = true)
public class DisplayUrlMojo extends AbstractMojo {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Undeploy application from liberty server. If no parameters have been defined
* the mojo will undeploy all applications from the server.
*/
@Mojo(name = "undeploy", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "undeploy", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)

public class UndeployAppMojo extends DeployMojoSupport {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2017, 2023.
* (C) Copyright IBM Corporation 2017, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,7 +42,7 @@
import io.openliberty.tools.common.arquillian.util.Constants;
import io.openliberty.tools.common.arquillian.util.HttpPortUtil;

@Mojo(name = "configure-arquillian", requiresDependencyResolution = ResolutionScope.TEST)
@Mojo(name = "configure-arquillian", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true)
public class ConfigureArquillianMojo extends BasicSupport {

@Parameter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2017, 2023.
* (C) Copyright IBM Corporation 2017, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,7 +37,7 @@
/**
* Compile the JSPs in the src/main/webapp folder.
*/
@Mojo(name = "compile-jsp", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE)
@Mojo(name = "compile-jsp", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true)
public class CompileJspMojo extends InstallFeatureSupport {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2023.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,7 +26,7 @@
/**
* Check a liberty server status
*/
@Mojo(name = "status")
@Mojo(name = "status", threadSafe = true)
public class CheckStatusMojo extends StartDebugMojoSupport {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2016, 2023.
* (C) Copyright IBM Corporation 2016, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@
/**
* Clean the logs, workarea, dropins and apps directories.
*/
@Mojo(name = "clean")
@Mojo(name = "clean", threadSafe = true)
public class CleanServerMojo extends StartDebugMojoSupport {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2023.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,7 @@
/**
* Create a liberty server
*/
@Mojo(name = "create", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "create", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class CreateServerMojo extends PluginConfigSupport {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2017, 2023.
* (C) Copyright IBM Corporation 2017, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,7 @@
/**
* Start a liberty server in debug mode
*/
@Mojo(name = "debug", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "debug", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)

public class DebugServerMojo extends StartDebugMojoSupport {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2019, 2023.
* (C) Copyright IBM Corporation 2019, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -83,7 +83,7 @@
* Start a liberty server in dev mode import to set ResolutionScope for TEST as
* it helps build full transitive dependency classpath
*/
@Mojo(name = "dev", requiresDependencyCollection = ResolutionScope.TEST, requiresDependencyResolution = ResolutionScope.TEST)
@Mojo(name = "dev", requiresDependencyCollection = ResolutionScope.TEST, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true)
public class DevMojo extends LooseAppSupport {

private static final String TEST_RUN_ID_PROPERTY_NAME = "liberty.dev.test.run.id";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2020, 2023.
* (C) Copyright IBM Corporation 2020, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
/**
* Start dev mode for containers
*/
@Mojo(name = "devc", requiresDependencyCollection = ResolutionScope.TEST, requiresDependencyResolution = ResolutionScope.TEST)
@Mojo(name = "devc", requiresDependencyCollection = ResolutionScope.TEST, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true)
public class DevcMojo extends DevMojo {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2023.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@
/**
* Dump diagnostic information from the server into an archive.
*/
@Mojo(name = "dump", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "dump", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class DumpServerMojo extends StartDebugMojoSupport {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2021, 2023.
* (C) Copyright IBM Corporation 2021, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down Expand Up @@ -53,7 +53,7 @@
* them in a new featureManager element in a new XML file in the source
* config/dropins directory.
*/
@Mojo(name = "generate-features")
@Mojo(name = "generate-features", threadSafe = true)
public class GenerateFeaturesMojo extends ServerFeatureSupport {

public static final String FEATURES_FILE_MESSAGE = "The Liberty Maven Plugin has generated Liberty features necessary for your application in "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2015, 2023.
* (C) Copyright IBM Corporation 2015, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down Expand Up @@ -39,7 +39,7 @@
* This mojo installs a feature packaged as a Subsystem Archive (esa) to the
* runtime.
*/
@Mojo(name = "install-feature")
@Mojo(name = "install-feature", threadSafe = true)
public class InstallFeatureMojo extends InstallFeatureSupport {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2023.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
/**
* Install a liberty server
*/
@Mojo(name = "install-server", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "install-server", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class InstallServerMojo extends PluginConfigSupport {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2023.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,7 @@
/**
* Dump diagnostic information from the server JVM.
*/
@Mojo(name = "java-dump", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "java-dump", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class JavaDumpServerMojo extends StartDebugMojoSupport {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2023.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,7 +36,7 @@
/**
* Package a liberty server
*/
@Mojo(name = "package", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "package", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class PackageServerMojo extends StartDebugMojoSupport {

private enum PackageFileType {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2021, 2023.
* (C) Copyright IBM Corporation 2021, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down Expand Up @@ -31,7 +31,7 @@
* This mojo generates JSON files so user features can be installed
* from a specified BOM
*/
@Mojo(name = "prepare-feature")
@Mojo(name = "prepare-feature", threadSafe = true)
public class PrepareFeatureMojo extends PrepareFeatureSupport {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2023.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,7 @@
/**
* Start a liberty server
*/
@Mojo(name = "run", requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "run", requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class RunServerMojo extends PluginConfigSupport {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2023.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,7 @@
/**
* Start a liberty server
*/
@Mojo(name = "start", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
@Mojo(name = "start", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)

public class StartServerMojo extends StartDebugMojoSupport {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2014, 2023.
* (C) Copyright IBM Corporation 2014, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,7 +26,7 @@
/**
* Stop a liberty server
*/
@Mojo(name = "stop")
@Mojo(name = "stop", threadSafe = true)
public class StopServerMojo extends StartDebugMojoSupport {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2017, 2019.
* (C) Copyright IBM Corporation 2017, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
/**
* Start a liberty server if tests are not skipped
*/
@Mojo(name = "test-start")
@Mojo(name = "test-start", threadSafe = true)

public class TestStartServerMojo extends StartServerMojo {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2017, 2019.
* (C) Copyright IBM Corporation 2017, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
/**
* Quickly bypass stopping server if server isn't started
*/
@Mojo(name = "test-stop")
@Mojo(name = "test-stop", threadSafe = true)

public class TestStopServerMojo extends StopServerMojo {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corporation 2015, 2020.
* (C) Copyright IBM Corporation 2015, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Expand Down Expand Up @@ -34,7 +34,7 @@
* This mojo uninstalls a feature packaged as a Subsystem Archive (esa) from the
* runtime.
*/
@Mojo(name = "uninstall-feature")
@Mojo(name = "uninstall-feature", threadSafe = true)

public class UninstallFeatureMojo extends BasicSupport {

Expand Down

0 comments on commit 9389e2c

Please sign in to comment.