Skip to content

Commit 6ce7085

Browse files
committed
add synchronized for the public methods that log to ReportPortal
1 parent 677893e commit 6ce7085

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/main/java/com/znsio/reportportal/integration/properties/ReportPortalPropertiesOverloader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ReportPortalPropertiesOverloader {
2828
"Use ReportPortal configuration: \n" +
2929
"--------------------------------\n";
3030

31-
public static ListenerParameters getProperties() {
31+
public synchronized static ListenerParameters getProperties() {
3232
setLaunchName();
3333
setSystemAttributes();
3434
setTestAttributes();

src/main/java/com/znsio/reportportal/integration/utils/ReportPortalLogger.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,48 @@ private ReportPortalLogger() {
2222
LOGGER.debug("ReportPortalLogger - private constructor");
2323
}
2424

25-
public static void captureAndAttachScreenshot(WebDriver webDriver) {
25+
public synchronized static void captureAndAttachScreenshot(WebDriver webDriver) {
2626
captureAndAttachScreenshot(webDriver, DEFAULT_MESSAGE_FOR_SCREENSHOT);
2727
}
2828

29-
public static void captureAndAttachScreenshot(WebDriver webDriver, String message) {
29+
public synchronized static void captureAndAttachScreenshot(WebDriver webDriver, String message) {
3030
File destinationFile = ScreenShotManager.captureScreenShot(webDriver, DEFAULT_ROOT_DIRECTORY);
3131
attachScreenshotInReportPortal(message, destinationFile);
3232
}
3333

34-
public static void captureAndAttachScreenshot(WebDriver webDriver, File rootFolder) {
34+
public synchronized static void captureAndAttachScreenshot(WebDriver webDriver, File rootFolder) {
3535
captureAndAttachScreenshot(webDriver, rootFolder, DEFAULT_MESSAGE_FOR_SCREENSHOT);
3636
}
3737

38-
public static void captureAndAttachScreenshot(WebDriver webDriver, File rootFolder, String message) {
38+
public synchronized static void captureAndAttachScreenshot(WebDriver webDriver, File rootFolder, String message) {
3939
File destinationFile = ScreenShotManager.captureScreenShot(webDriver, rootFolder.getAbsolutePath());
4040
attachScreenshotInReportPortal(message, destinationFile);
4141
}
4242

43-
public static void attachFileInReportPortal(String message, File destinationFile) {
43+
public synchronized static void attachFileInReportPortal(String message, File destinationFile) {
4444
boolean isEmitLogSuccessful = ReportPortal.emitLog(message, INFO, new Date(), destinationFile);
4545
if (!isEmitLogSuccessful) {
4646
LOGGER.error(String.format("'%s' - Upload of file: '%s'::'%s' to ReportPortal failed",
4747
getCallingClassAndMethodName(), message, destinationFile));
4848
}
4949
}
5050

51-
public static void logDebugMessage(String message) {
51+
public synchronized static void logDebugMessage(String message) {
5252
LOGGER.debug(message);
5353
logMessage(message, DEBUG);
5454
}
5555

56-
public static void logWarningMessage(String message) {
56+
public synchronized static void logWarningMessage(String message) {
5757
LOGGER.warn(message);
5858
logMessage(message, WARN);
5959
}
6060

61-
public static void logInfoMessage(String message) {
61+
public synchronized static void logInfoMessage(String message) {
6262
LOGGER.info(message);
6363
logMessage(message, INFO);
6464
}
6565

66-
public static void logErrorMessage(String message) {
66+
public synchronized static void logErrorMessage(String message) {
6767
LOGGER.error(message);
6868
logMessage(message, ERROR);
6969
}

0 commit comments

Comments
 (0)