Class ProcessorService
java.lang.Object
io.github.eggy03.ferrumx.windows.service.processor.ProcessorService
- All Implemented Interfaces:
CommonServiceInterface<Processor>
Service class for fetching CPU information from the system.
This class executes the CimQuery.PROCESSOR_QUERY
PowerShell command
and maps the resulting JSON into Processor
objects.
Thread safety
Methods of class are not thread safe.Usage examples
// Convenience API (creates its own short-lived session)
ProcessorService processorService = new ProcessorService();
List<Processor> processors = processorService.getManaged();
// API with re-usable session (caller manages session lifecycle)
try (PowerShell session = PowerShell.openSession()) {
ProcessorService processorService = new ProcessorService();
List<Processor> processors = processorService.get(session);
}
- Since:
- 2.0.0
- Author:
- Egg-03
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ProcessorService
public ProcessorService()
-
-
Method Details
-
get
Retrieves a non-null list of processor entries present in the system.Each invocation creates and uses a short-lived PowerShell session internally.
- Specified by:
get
in interfaceCommonServiceInterface<Processor>
- Returns:
- a list of
Processor
objects representing the CPU(s). Returns an empty list if no processors are detected.
-
get
Retrieves a non-null list of processor entries using the caller'sPowerShell
session.- Specified by:
get
in interfaceCommonServiceInterface<Processor>
- Parameters:
powerShell
- an existing PowerShell session managed by the caller- Returns:
- a list of
Processor
objects representing the CPU(s). Returns an empty list if no processors are detected.
-