Package de.bytestore.hostinger.handler
Klasse SystemHandler
java.lang.Object
de.bytestore.hostinger.handler.SystemHandler
The SystemHandler class provides methods to retrieve various system information such as CPU usage, memory usage, and disk usage.
- Seit:
- 1.0.0
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected static boolean
protected static LinkedList<String>
protected static LinkedList<String>
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic double
getCachedValue
(StatsType typeIO) static Object
getCachedValue
(String keyIO) static Object
getCachedValue
(String keyIO, boolean renewIO) Retrieves the cached value for the given key.static LinkedList<Object>
getCachedValueList
(StatsType typeIO) static LinkedList<Object>
getCachedValueListNotRenew
(StatsType typeIO) static double
Retrieves the CPU temperature of the system.static double
Calculates the current CPU usage.static double
Calculates the CPU usage percentage in the system.static NetworkInterface
static double
Calculates the disk usage in the system.static long
Returns the maximum size of the heap in bytes.static double
Returns the current heap usage as a percentage.static double
Calculates the current heap usage percentage.static List<oshi.hardware.NetworkIF>
Retrieves a list of network interfaces.static long
Retrieves the total amount of memory available in the system.static double
Calculates the memory usage in the system.static double
Calculates the memory usage percentage of the system.static String
Retrieves the total network receive of the system.static String
Retrieves the total network send for a specific network interface.static String
static long
Calculates the total system disk capacity.static LinkedList<com.google.gson.JsonObject>
getUpdates
(String branchIO) Retrieves updates for the specified branch IO.static String
Retrieves the version of thestatic String
humanReadableByteCountBin
(long bytesA) static boolean
static void
load()
Loads the listeners for system statistics.static void
reload()
static void
startUpdate
(String branchIO, String urlIO, DownloadCallback callbackIO, boolean forceIO) Starts the update process.
-
Felddetails
-
cachedStats
-
upload
-
receive
-
cpuTempAvailable
protected static boolean cpuTempAvailable
-
-
Konstruktordetails
-
SystemHandler
public SystemHandler()
-
-
Methodendetails
-
getCPUUsage
public static double getCPUUsage()Calculates the current CPU usage.- Gibt zurück:
- The CPU usage as a percentage, represented as a long value.
-
getCPUTemperature
public static double getCPUTemperature()Retrieves the CPU temperature of the system.- Gibt zurück:
- The CPU temperature in degrees Celsius, represented as a double value.
-
getInterfaces
Retrieves a list of network interfaces.- Gibt zurück:
- A List of NetworkIF objects representing the network interfaces on the system.
-
getDefaultInterface
-
getNetworkSend
Retrieves the total network send for a specific network interface.- Gibt zurück:
- The total network send in bytes, represented as a formatted string value.
-
getNetworkReceive
Retrieves the total network receive of the system.- Gibt zurück:
- The total network receive in bytes, represented as a double value.
-
getMemoryTotal
public static long getMemoryTotal()Retrieves the total amount of memory available in the system.- Gibt zurück:
- The total memory available in the system, represented as a long value.
-
getMemoryUsage
public static double getMemoryUsage()Calculates the memory usage in the system.- Gibt zurück:
- The memory usage in the system, represented as a long value.
-
getTotalDiskCapacity
public static long getTotalDiskCapacity()Calculates the total system disk capacity.- Gibt zurück:
- The total system disk capacity, represented as a long value.
-
getDiskUsage
public static double getDiskUsage()Calculates the disk usage in the system.- Gibt zurück:
- The disk usage in the system, represented as a long value.
-
getCPUUsagePercentage
public static double getCPUUsagePercentage()Calculates the CPU usage percentage in the system.- Gibt zurück:
- The CPU usage percentage in the system, represented as a double value.
-
getMemoryUsagePercentage
public static double getMemoryUsagePercentage()Calculates the memory usage percentage of the system.- Gibt zurück:
- The memory usage percentage as a double value.
-
getHeapUsage
public static double getHeapUsage()Returns the current heap usage as a percentage.- Gibt zurück:
- the heap usage as a percentage
-
getHeapMax
public static long getHeapMax()Returns the maximum size of the heap in bytes.- Gibt zurück:
- the maximum size of the heap
-
load
public static void load()Loads the listeners for system statistics.The following listeners are added:
StatsType.SYSTEM_CPU_USAGE
:getCPUUsage()
StatsType.SYSTEM_MEMORY_USAGE
:getMemoryUsage()
StatsType.SYSTEM_DISK_USAGE
:getDiskUsage()
StatsType.SYSTEM_HEAP_USAGE
:getHeapUsage()
StatsType.SYSTEM_DISK_PERCENT
:getDiskUsagePercentage()
StatsType.SYSTEM_CPU_PERCENT
:getCPUUsagePercentage()
StatsType.SYSTEM_MEMORY_PERCENT
:getMemoryUsagePercentage()
StatsType.SYSTEM_HEAP_PERCENT
:getHeapUsagePercentage()
StatsType.SYSTEM_NETWORK_SEND
: Anonymous function that adds the result ofgetNetworkSend()
to the cache and returns itStatsType.SYSTEM_NETWORK_RECEIVE
:getNetworkReceive()
-
getHeapUsagePercentage
public static double getHeapUsagePercentage()Calculates the current heap usage percentage.- Gibt zurück:
- The heap usage percentage as a double value.
-
reload
public static void reload() -
getCachedValue
-
getCachedValueListNotRenew
-
getCachedValueList
-
getCachedValue
-
getCachedValue
Retrieves the cached value for the given key. If the value is not found in the cache, it is fetched from the data source and added to the cache.- Parameter:
keyIO
- The key for the cached value.- Gibt zurück:
- The cached value associated with the key.
-
humanReadableByteCountBin
-
isWindows
public static boolean isWindows() -
getOperatingSystem
-
getUpdates
Retrieves updates for the specified branch IO.- Parameter:
branchIO
- The branch IO for which updates are retrieved.- Gibt zurück:
- An ArrayList of JsonObject containing the updates.
- Löst aus:
RuntimeException
- if there is an IOException while retrieving updates.
-
startUpdate
public static void startUpdate(String branchIO, String urlIO, DownloadCallback callbackIO, boolean forceIO) Starts the update process.- Parameter:
branchIO
- The branch IO for which updates are retrieved.urlIO
- The URL for the update.forceIO
- A flag indicating whether to force the update.- Löst aus:
MalformedURLException
- if the URL is not valid.
-
getVersion
Retrieves the version of the
-