1 /* 2 * Copyright 2019-2022 The OSHI Project Contributors 3 * SPDX-License-Identifier: MIT 4 */ 5 package oshi.software.os; 6 7 import oshi.annotation.concurrent.Immutable; 8 9 /** 10 * Operating system services are responsible for the management of platform resources, including the processor, memory, 11 * files, and input and output. They generally shield applications from the implementation details of the machine. 12 * <p> 13 * This class is provided for information purposes only. Interpretation of the meaning of services is 14 * platform-dependent. 15 */ 16 @Immutable 17 public class OSService { 18 19 private final String name; 20 private final int processID; 21 private final State state; 22 23 /** 24 * Service Execution States 25 */ 26 public enum State { 27 RUNNING, STOPPED, OTHER 28 } 29 30 /** 31 * Instantiate a new {@link OSService}. 32 * 33 * @param name The service name. 34 * @param processID The process ID if running, or 0 if stopped. 35 * @param state The service {@link State}. 36 */ 37 public OSService(String name, int processID, State state) { 38 this.name = name; 39 this.processID = processID; 40 this.state = state; 41 } 42 43 /** 44 * <p> 45 * Getter for the field <code>name</code>. 46 * </p> 47 * 48 * @return Returns the name of the service. 49 */ 50 public String getName() { 51 return this.name; 52 } 53 54 /** 55 * <p> 56 * Getter for the field <code>processID</code>. 57 * </p> 58 * 59 * @return Returns the processID. 60 */ 61 public int getProcessID() { 62 return this.processID; 63 } 64 65 /** 66 * <p> 67 * Getter for the field <code>state</code>. 68 * </p> 69 * 70 * @return Returns the state of the service. 71 */ 72 public State getState() { 73 return this.state; 74 } 75 76 }