Alachisoft.NCache.Common.Stats.SystemMemoryTask Maven / Gradle / Ivy
package Alachisoft.NCache.Common.Stats;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using Interlocked = System.Threading.Interlocked;
/**
*
*/
public final class SystemMemoryTask {
//implements TimeScheduler.Task, IDisposable {
// private static final long _updateInterval = 2000;
// private static final String _systemAssembly = "\\root\\cimv2";
// private String _machineName = Environment.MachineName.toLowerCase();
//
// private ManagementScope _managementScope;
// private ManagementObjectSearcher _searcher;
//
// private static Object _mutex = new Object();
//
////C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
////ORIGINAL LINE: private static ulong _totalMemory;
// private static long _totalMemory;
////C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
////ORIGINAL LINE: private static ulong _memoryUsed;
// private static long _memoryUsed;
//
// /**
//
// */
// public SystemMemoryTask(ILogger NCacheLog) {
// //nTrace = trace;
// //this._managementScope = new ManagementScope("\\\\" + _machineName + _systemAssembly);
// //this._searcher = new ManagementObjectSearcher(this._managementScope, new ObjectQuery("Select CommitLimit, CommittedBytes from Win32_PerfRawData_PerfOS_Memory"));
// //_searcher.Options.Timeout = new TimeSpan(0, 0, 2);
// //_searcher.Options.ReturnImmediately = true;
// }
//
// /**
// Get the total amount of memory
// */
////C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
// //[CLSCompliant(false)]
// public static long getTotalMemory() {
// synchronized (_mutex) {
// return _totalMemory;
// }
// }
//
// /**
// Get the amount of memory used
// */
////C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
// //[CLSCompliant(false)]
// public static long getMemoryUsed() {
// synchronized (_mutex) {
// return _memoryUsed;
// }
// }
//
// /**
// Percentage of memory used
// */
// public static int getPercentMemoryUsed() {
// return 0;
// }
//
////C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET attributes:
// //[CLSCompliant(false)]
// public static long getMemoryLeft() {
// synchronized (_mutex) {
// return _totalMemory - _memoryUsed;
// }
// }
//
////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
// ///#region Task Members
//
// /**
//
//
// @return
// */
// public boolean IsCancelled() {
// return false;
// }
//
// /**
// Get the next interval in which to execute Run() method
//
// @return
// */
// public long GetNextInterval() {
// return _updateInterval;
// }
//
// /**
// Get memory status form WMI Repository
// */
// public void Run() {
// try {
// return; //we dont want to execute this task.
////C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
////ORIGINAL LINE: ulong totalMemory = 0;
// long totalMemory = 0;
////C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
////ORIGINAL LINE: ulong memoryUsed = 0;
// long memoryUsed = 0;
//
// ManagementObjectCollection objCol = this._searcher.Get();
// for (ManagementObject obj : objCol) {
////C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
////ORIGINAL LINE: totalMemory = (ulong)obj.GetPropertyValue("CommitLimit") / 1024;
// totalMemory = (long)obj.GetPropertyValue("CommitLimit") / 1024;
////C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
////ORIGINAL LINE: memoryUsed = (ulong)obj.GetPropertyValue("CommittedBytes") / 1024;
// memoryUsed = (long)obj.GetPropertyValue("CommittedBytes") / 1024;
// }
//
// synchronized (_mutex) {
// _totalMemory = totalMemory;
// _memoryUsed = memoryUsed;
// }
// } catch (RuntimeException e) {
// }
// }
//
////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
// ///#endregion
//
////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
// ///#region IDisposable Members
//
// /**
//
// */
// public void dispose() {
// if (this._searcher != null) {
// this._searcher.dispose();
// }
// }
//
////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
// ///#endregion
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy