public class EnvironmentInformation extends Object
Modifier and Type | Class and Description |
---|---|
static class |
EnvironmentInformation.RevisionInformation
Revision information encapsulates information about the source code revision of the Flink
code.
|
Modifier and Type | Field and Description |
---|---|
static String |
UNKNOWN |
static String |
UNKNOWN_COMMIT_ID |
static String |
UNKNOWN_COMMIT_ID_ABBREV |
Modifier and Type | Method and Description |
---|---|
static java.time.Instant |
getBuildTime() |
static String |
getBuildTimeString() |
static String |
getGitCommitId() |
static String |
getGitCommitIdAbbrev() |
static java.time.Instant |
getGitCommitTime() |
static String |
getGitCommitTimeString() |
static String |
getHadoopUser()
Gets the name of the user that is running the JVM.
|
static String |
getHadoopVersionString() |
static String |
getJvmStartupOptions()
Gets the system parameters and environment parameters that were passed to the JVM on startup.
|
static String[] |
getJvmStartupOptionsArray()
Gets the system parameters and environment parameters that were passed to the JVM on startup.
|
static String |
getJvmVersion()
Gets the version of the JVM in the form "VM_Name - Vendor - Spec/Version".
|
static long |
getMaxJvmHeapMemory()
The maximum JVM heap size, in bytes.
|
static long |
getOpenFileHandlesLimit()
Tries to retrieve the maximum number of open file handles.
|
static EnvironmentInformation.RevisionInformation |
getRevisionInformation()
Returns the code revision (commit and commit date) of Flink, as generated by the Maven
builds.
|
static String |
getScalaVersion()
Returns the version of the used Scala compiler as String.
|
static long |
getSizeOfFreeHeapMemory()
Gets an estimate of the size of the free heap memory.
|
static long |
getSizeOfFreeHeapMemoryWithDefrag()
Gets an estimate of the size of the free heap memory.
|
static String |
getTemporaryFileDirectory()
Gets the directory for temporary files, as returned by the JVM system property
"java.io.tmpdir".
|
static String |
getVersion()
Returns the version of the code as String.
|
static void |
logEnvironmentInfo(org.slf4j.Logger log,
String componentName,
String[] commandLineArgs)
Logs information about the environment, like code revision, current user, Java version, and
JVM parameters.
|
@VisibleForTesting public static final String UNKNOWN_COMMIT_ID
@VisibleForTesting public static final String UNKNOWN_COMMIT_ID_ABBREV
public static final String UNKNOWN
public static String getVersion()
public static String getScalaVersion()
public static java.time.Instant getBuildTime()
public static String getBuildTimeString()
public static String getGitCommitId()
public static String getGitCommitIdAbbrev()
public static java.time.Instant getGitCommitTime()
public static String getGitCommitTimeString()
public static EnvironmentInformation.RevisionInformation getRevisionInformation()
public static String getHadoopUser()
public static long getMaxJvmHeapMemory()
This method uses the -Xmx value of the JVM, if set. If not set, it returns (as a heuristic) 1/4th of the physical memory size.
public static long getSizeOfFreeHeapMemoryWithDefrag()
NOTE: This method is heavy-weight. It triggers a garbage collection to reduce
fragmentation and get a better estimate at the size of free memory. It is typically more
accurate than the plain version getSizeOfFreeHeapMemory()
.
public static long getSizeOfFreeHeapMemory()
getSizeOfFreeHeapMemoryWithDefrag()
.public static String getJvmVersion()
public static String getJvmStartupOptions()
public static String[] getJvmStartupOptionsArray()
public static String getTemporaryFileDirectory()
public static long getOpenFileHandlesLimit()
If the number of max open file handles cannot be determined, this method returns -1
.
-1
, if the limit could not be determined.public static void logEnvironmentInfo(org.slf4j.Logger log, String componentName, String[] commandLineArgs)
log
- The logger to log the information to.componentName
- The component name to mention in the log.commandLineArgs
- The arguments accompanying the starting the component.public static String getHadoopVersionString()
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.