@SuppressWarnings("unchecked")
List<String> serviceNames = Service.getServiceNames();
if (serviceNames != null) {
for (String serviceName : serviceNames) {
Service s = null;
try {
s = new Service(serviceName);
ServiceConfig sc = s.getConfig();
ServiceInfo si = new ServiceInfo(sc.getName(), sc.getDisplayName(), sc.getDescription(), sc
.getPath(), sc.getDependencies());
services.add(si);
} catch (Win32Exception e) {
; // Ignore these, it means Sigar was rejected by Windows for the particular Service.
} finally {
if (null != s) {
s.close();
}
}
}
}
} catch (Exception e) {