|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSystemManager
public abstract class SystemManager
A unified interface to OS-specific implementation of a system manager.
SystemManager provides methods for sampling system and process status information.
Use getSystemManager method to create an OS specific implementation.
Access to process information is done through process identifiers (PIDs) and process handles. On some OSes (e.g. Windows) process handle makes sure that process information is available until the handle is closed, however one cannot rely on this as other implementations (e.g. Linux) may still fail even if handle has not been closed.
getSystemManager()
,
ProcessStatus
,
SystemMemoryStatus
,
Runtime.exec(java.lang.String)
Constructor Summary | |
---|---|
protected |
SystemManager()
|
Method Summary | |
---|---|
abstract void |
closeProcessHandle(int handle)
Closes a process handle (which was opened by openProcessHandle). |
abstract int |
fetchProcessIDs(int[] pids)
Fills the integer array with PIDs (process identifiers) of currently running processes. |
abstract boolean |
fetchProcessStatus(int handle,
ProcessStatus ps)
Fills the ps structure with process status information. |
abstract boolean |
fetchSystemMemoryStatus(SystemMemoryStatus sms)
Fills the sms structure with system memory status information. |
abstract String |
getProcessName(int hProcess)
Retrieves the name of executable referenced by process handle. |
ProcessStatus |
getProcessStatus(int handle)
A-not-so-memory-efficient version of fetchProcessStatus. |
static SystemManager |
getSystemManager()
Returns an OS-specific implementation of a system manager. |
SystemMemoryStatus |
getSystemMemoryStatus()
A-not-so-memory-efficient version of fetchSystemMemoryStatus. |
protected static void |
loadTmpLibrary(String libsource,
String prefix,
String suffix)
Copies the resource into temporary directory and loads it as a library. |
abstract int |
openProcessHandle(int processID)
Opens a handle to a process with given identifier. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SystemManager()
Method Detail |
---|
public abstract boolean fetchSystemMemoryStatus(SystemMemoryStatus sms)
sms
- the SystemMemoryStatus object, should not be null.
SystemMemoryStatus
public SystemMemoryStatus getSystemMemoryStatus()
fetchSystemMemoryStatus(SystemMemoryStatus)
,
SystemMemoryStatus
public abstract boolean fetchProcessStatus(int handle, ProcessStatus ps)
handle
- (OS specific) handle to a process, created from
openProcessHandle.ps
- ProcessStatus object, should not be null.
openProcessHandle(int)
,
ProcessStatus
public ProcessStatus getProcessStatus(int handle)
fetchProcessStatus(int, ProcessStatus)
,
openProcessHandle(int)
,
ProcessStatus
public abstract int openProcessHandle(int processID)
processID
- (host OS specific) process identifier.
closeProcessHandle(int)
public abstract void closeProcessHandle(int handle)
handle
- the open process handle.openProcessHandle(int)
public abstract int fetchProcessIDs(int[] pids)
pids
- non-null array of integers to be filled with PIDs.
public abstract String getProcessName(int hProcess)
hProcess
- is a handle to a process created by openProcessHandle.
protected static void loadTmpLibrary(String libsource, String prefix, String suffix) throws IOException
IOException
public static SystemManager getSystemManager()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |