Skip to content

Commit

Permalink
NR-215332 : Add java temp directory to ServerInfo (#161)
Browse files Browse the repository at this point in the history
* NR-215332 : Add java temp directory to ServerInfo
  • Loading branch information
lovesh-ap authored Jan 16, 2024
1 parent f8e7686 commit 2e0225f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ public interface IUtilConstants {

String SERVER_BASE_DIRECTORY = "SERVER_BASE_DIRECTORY";
String SAME_SITE_COOKIES = "SAME_SITE_COOKIES";

String APPLICATION_TMP_DIRECTORY = "APPLICATION_TMP_DIRECTORY";
String JAVA_IO_TMPDIR = "java.io.tmpdir";
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,16 @@ private void initialise() {
info.initStatusLogValues();
setInitialised(true);
populateLinkingMetadata();

populateApplicationTmpDir();
startK2Services();
info.agentStatTrigger();
}

private void populateApplicationTmpDir() {
String tmpDir = System.getProperty(IUtilConstants.JAVA_IO_TMPDIR);
setServerInfo(IUtilConstants.APPLICATION_TMP_DIRECTORY, tmpDir);
}

private BuildInfo readCollectorBuildInfo() {
BuildInfo buildInfo = new BuildInfo();
try {
Expand Down Expand Up @@ -538,6 +543,8 @@ public void setServerInfo(String key, String value) {
case IUtilConstants.SAME_SITE_COOKIES:
appServerInfo.setSameSiteCookies(value);
break;
case IUtilConstants.APPLICATION_TMP_DIRECTORY:
appServerInfo.setApplicationTmpDirectory(value);
default:
break;
}
Expand All @@ -554,6 +561,8 @@ public String getServerInfo(String key) {
return appServerInfo.getServerBaseDirectory();
case IUtilConstants.SAME_SITE_COOKIES:
return appServerInfo.getSameSiteCookies();
case IUtilConstants.APPLICATION_TMP_DIRECTORY:
return appServerInfo.getApplicationTmpDirectory();
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class AppServerInfo {

String sameSiteCookies;

String applicationTmpDirectory;

public String getApplicationDirectory() {
return applicationDirectory;
}
Expand All @@ -31,4 +33,12 @@ public String getSameSiteCookies() {
public void setSameSiteCookies(String sameSiteCookies) {
this.sameSiteCookies = sameSiteCookies;
}

public String getApplicationTmpDirectory() {
return applicationTmpDirectory;
}

public void setApplicationTmpDirectory(String applicationTmpDirectory) {
this.applicationTmpDirectory = applicationTmpDirectory;
}
}

0 comments on commit 2e0225f

Please sign in to comment.