Skip to content

Commit

Permalink
make ReportPortalListener singleton. Updated version to 0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
anandbagmar committed Sep 18, 2024
1 parent 1a8832d commit c62c957
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
20 changes: 19 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>com.github.znsio</groupId>
<artifactId>ReportPortalIntegration</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
<name>ReportPortalIntegration</name>

<properties>
Expand Down Expand Up @@ -51,4 +51,22 @@
<url>https://jitpack.io</url>
</repository>
</repositories>
<build>
<plugins>
<!-- Maven Source Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,24 @@
import com.znsio.reportportal.integration.utils.ParamOverrideTestNgService;

public class ReportPortalListener extends BaseTestNGListener {
public ReportPortalListener() {
// Volatile variable to ensure visibility of changes across threads
private static volatile ReportPortalListener instance;

private ReportPortalListener() {
super(new ParamOverrideTestNgService(ReportPortalPropertiesOverloader.getProperties()));
}

public static ReportPortalListener getInstance() {
if (instance == null) {
synchronized (ReportPortalListener.class) {
if (instance == null) {
System.out.println("Initializing ReportPortalListener");
instance = new ReportPortalListener();
}
}
} else {
System.out.println("ReportPortalListener already initialized");
}
return instance;
}
}

0 comments on commit c62c957

Please sign in to comment.