Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
parthban-db committed Jan 31, 2025
1 parent d74f9a2 commit 4e58dd2
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ private static List<CicdProvider> listCiCdProviders() {
);
}

// Volatile fields to ensure thread-safe lazy initialization
// Volatile field to ensure thread-safe lazy initialization
// The 'volatile' keyword ensures that changes to these variables
// are immediately visible to all threads. It prevents instruction
// reordering by the compiler.
protected static volatile String cicdProvider = null;
protected static volatile Environment env = null;
private static volatile String cicdProvider = null;

protected static Environment env = null;

// Represents an environment variable with its name and expected value
private static class EnvVar {
Expand Down Expand Up @@ -228,7 +229,7 @@ private static String cicdProvider() {
return cicdProvider;
}

protected static Environment env() {
private static Environment env() {
if (env == null) {
env = new Environment(System.getenv(), System.getenv("PATH").split(File.pathSeparator), System.getProperty("os.name"));
}
Expand Down

0 comments on commit 4e58dd2

Please sign in to comment.