Package software.amazon.awssdk.crt
Class CRT
- java.lang.Object
-
- software.amazon.awssdk.crt.CRT
-
public final class CRT extends Object
This class is responsible for loading the aws-crt-jni shared lib for the current platform out of aws-crt-java.jar. One instance of this class has to be created somewhere to invoke the static initialization block which will load the shared lib
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CRT.UnknownPlatformException
Exception thrown when we can't detect what platform we're running on and thus can't figure out the native library name/path to load.
-
Field Summary
Fields Modifier and Type Field Description static int
AWS_CRT_SUCCESS
-
Constructor Summary
Constructors Constructor Description CRT()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
awsErrorName(int errorCode)
Given an integer error code from an internal operationstatic String
awsErrorString(int errorCode)
Given an integer error code from an internal operationstatic int
awsLastError()
Returns the last error on the current thread.static void
checkJniExceptionContract(boolean clearException)
static void
dumpNativeMemory()
Dump info to logs about all memory currently allocated by native resources.static String
getArchIdentifier()
static String
getCRuntime(String osIdentifier)
static String
getOSIdentifier()
static CrtPlatform
getPlatformImpl()
static long
nativeMemory()
-
-
-
Field Detail
-
AWS_CRT_SUCCESS
public static final int AWS_CRT_SUCCESS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getOSIdentifier
public static String getOSIdentifier() throws CRT.UnknownPlatformException
- Returns:
- a string describing the detected platform the CRT is executing on
- Throws:
CRT.UnknownPlatformException
-
getArchIdentifier
public static String getArchIdentifier() throws CRT.UnknownPlatformException
- Returns:
- a string describing the detected architecture the CRT is executing on
- Throws:
CRT.UnknownPlatformException
-
getPlatformImpl
public static CrtPlatform getPlatformImpl()
-
awsLastError
public static int awsLastError()
Returns the last error on the current thread.- Returns:
- Last error code recorded in this thread
-
awsErrorString
public static String awsErrorString(int errorCode)
Given an integer error code from an internal operation- Parameters:
errorCode
- An error code returned from an exception or other native function call- Returns:
- A user-friendly description of the error
-
awsErrorName
public static String awsErrorName(int errorCode)
Given an integer error code from an internal operation- Parameters:
errorCode
- An error code returned from an exception or other native function call- Returns:
- A string identifier for the error
-
nativeMemory
public static long nativeMemory()
- Returns:
- The number of bytes allocated in native resources. If aws.crt.memory.tracing is 1 or 2, this will be a non-zero value. Otherwise, no tracing will be done, and the value will always be 0
-
dumpNativeMemory
public static void dumpNativeMemory()
Dump info to logs about all memory currently allocated by native resources. The following system properties must be set to see a dump: aws.crt.memory.tracing must be 1 or 2 aws.crt.log.level must be "Trace"
-
checkJniExceptionContract
public static void checkJniExceptionContract(boolean clearException)
-
-