mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
Minor changes
This commit is contained in:
parent
a99d4eed11
commit
f4bc81f93e
@ -56,8 +56,8 @@ public class ServicesMonitor {
|
|||||||
private static final int NUMBER_OF_PERIODIC_TASK_THREADS = 1;
|
private static final int NUMBER_OF_PERIODIC_TASK_THREADS = 1;
|
||||||
private static final long CRASH_DETECTION_INTERVAL_MINUTES = 2;
|
private static final long CRASH_DETECTION_INTERVAL_MINUTES = 2;
|
||||||
|
|
||||||
private static final Set<String> serviceNames = Stream.of(ServicesMonitor.Service.values())
|
private static final Set<String> serviceNames = Stream.of(ServicesMonitor.ServiceName.values())
|
||||||
.map(ServicesMonitor.Service::toString)
|
.map(ServicesMonitor.ServiceName::toString)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,9 +66,11 @@ public class ServicesMonitor {
|
|||||||
private final ConcurrentHashMap<String, String> statusByService;
|
private final ConcurrentHashMap<String, String> statusByService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of services that are being monitored.
|
* List of services that are being monitored. The service names should be
|
||||||
|
* representative of the service functionality and readable as they get
|
||||||
|
* logged when service outage occurs.
|
||||||
*/
|
*/
|
||||||
public enum Service {
|
public enum ServiceName {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property change event fired when remote case database status changes.
|
* Property change event fired when remote case database status changes.
|
||||||
@ -272,14 +274,14 @@ public class ServicesMonitor {
|
|||||||
dbServerIsRunning = true;
|
dbServerIsRunning = true;
|
||||||
logger.log(Level.INFO, "Connection to PostgreSQL server restored"); //NON-NLS
|
logger.log(Level.INFO, "Connection to PostgreSQL server restored"); //NON-NLS
|
||||||
MessageNotifyUtil.Notify.info(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredDbService.notify.msg"));
|
MessageNotifyUtil.Notify.info(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredDbService.notify.msg"));
|
||||||
setServiceStatus(Service.REMOTE_CASE_DATABASE.toString(), ServiceStatus.UP.toString());
|
setServiceStatus(ServiceName.REMOTE_CASE_DATABASE.toString(), ServiceStatus.UP.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (dbServerIsRunning) {
|
if (dbServerIsRunning) {
|
||||||
dbServerIsRunning = false;
|
dbServerIsRunning = false;
|
||||||
logger.log(Level.SEVERE, "Failed to connect to PostgreSQL server"); //NON-NLS
|
logger.log(Level.SEVERE, "Failed to connect to PostgreSQL server"); //NON-NLS
|
||||||
MessageNotifyUtil.Notify.error(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedDbService.notify.msg"));
|
MessageNotifyUtil.Notify.error(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedDbService.notify.msg"));
|
||||||
setServiceStatus(Service.REMOTE_CASE_DATABASE.toString(), ServiceStatus.DOWN.toString());
|
setServiceStatus(ServiceName.REMOTE_CASE_DATABASE.toString(), ServiceStatus.DOWN.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,14 +292,14 @@ public class ServicesMonitor {
|
|||||||
solrServerIsRunning = true;
|
solrServerIsRunning = true;
|
||||||
logger.log(Level.INFO, "Connection to Solr server restored"); //NON-NLS
|
logger.log(Level.INFO, "Connection to Solr server restored"); //NON-NLS
|
||||||
MessageNotifyUtil.Notify.info(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredSolrService.notify.msg"));
|
MessageNotifyUtil.Notify.info(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredSolrService.notify.msg"));
|
||||||
setServiceStatus(Service.REMOTE_KEYWORD_SEARCH.toString(), ServiceStatus.UP.toString());
|
setServiceStatus(ServiceName.REMOTE_KEYWORD_SEARCH.toString(), ServiceStatus.UP.toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (solrServerIsRunning) {
|
if (solrServerIsRunning) {
|
||||||
solrServerIsRunning = false;
|
solrServerIsRunning = false;
|
||||||
logger.log(Level.SEVERE, "Failed to connect to Solr server"); //NON-NLS
|
logger.log(Level.SEVERE, "Failed to connect to Solr server"); //NON-NLS
|
||||||
MessageNotifyUtil.Notify.error(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedSolrService.notify.msg"));
|
MessageNotifyUtil.Notify.error(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedSolrService.notify.msg"));
|
||||||
setServiceStatus(Service.REMOTE_KEYWORD_SEARCH.toString(), ServiceStatus.DOWN.toString());
|
setServiceStatus(ServiceName.REMOTE_KEYWORD_SEARCH.toString(), ServiceStatus.DOWN.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,14 +313,14 @@ public class ServicesMonitor {
|
|||||||
messageServerIsRunning = true;
|
messageServerIsRunning = true;
|
||||||
logger.log(Level.INFO, "Connection to ActiveMQ server restored"); //NON-NLS
|
logger.log(Level.INFO, "Connection to ActiveMQ server restored"); //NON-NLS
|
||||||
MessageNotifyUtil.Notify.info(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredMessageService.notify.msg"));
|
MessageNotifyUtil.Notify.info(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.restoredMessageService.notify.msg"));
|
||||||
setServiceStatus(Service.MESSAGING.toString(), ServiceStatus.UP.toString());
|
setServiceStatus(ServiceName.MESSAGING.toString(), ServiceStatus.UP.toString());
|
||||||
}
|
}
|
||||||
} catch (URISyntaxException | JMSException ex) {
|
} catch (URISyntaxException | JMSException ex) {
|
||||||
if (messageServerIsRunning) {
|
if (messageServerIsRunning) {
|
||||||
messageServerIsRunning = false;
|
messageServerIsRunning = false;
|
||||||
logger.log(Level.SEVERE, "Failed to connect to ActiveMQ server", ex); //NON-NLS
|
logger.log(Level.SEVERE, "Failed to connect to ActiveMQ server", ex); //NON-NLS
|
||||||
MessageNotifyUtil.Notify.error(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedMessageService.notify.msg"));
|
MessageNotifyUtil.Notify.error(NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedService.notify.title"), NbBundle.getMessage(ServicesMonitor.class, "ServicesMonitor.failedMessageService.notify.msg"));
|
||||||
setServiceStatus(Service.MESSAGING.toString(), ServiceStatus.DOWN.toString());
|
setServiceStatus(ServiceName.MESSAGING.toString(), ServiceStatus.DOWN.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,16 +327,16 @@ public class IngestManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribe ingest manager to service monitor events.
|
* Subscribe ingest manager to service monitor events. Cancels ingest
|
||||||
|
* if one of services it's subscribed to goes down.
|
||||||
*/
|
*/
|
||||||
private void subscribeToServiceMonitorEvents() {
|
private void subscribeToServiceMonitorEvents() {
|
||||||
PropertyChangeListener propChangeListener = new PropertyChangeListener() {
|
PropertyChangeListener propChangeListener = new PropertyChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
|
if (evt.getNewValue().equals(ServicesMonitor.ServiceStatus.DOWN.toString())) {
|
||||||
|
// one of the services we subscribed to went down
|
||||||
String serviceName = evt.getPropertyName();
|
String serviceName = evt.getPropertyName();
|
||||||
if (evt.getNewValue() == ServicesMonitor.ServiceStatus.DOWN.toString()) {
|
|
||||||
// one of the services we subscribed for went down
|
|
||||||
|
|
||||||
logger.log(Level.SEVERE, "Service {0} is down! Cancelling all running ingest jobs", serviceName); //NON-NLS
|
logger.log(Level.SEVERE, "Service {0} is down! Cancelling all running ingest jobs", serviceName); //NON-NLS
|
||||||
|
|
||||||
// display notification if running interactively
|
// display notification if running interactively
|
||||||
@ -355,8 +355,8 @@ public class IngestManager {
|
|||||||
|
|
||||||
// subscribe to services of interest
|
// subscribe to services of interest
|
||||||
Set<String> servicesList = new HashSet<>();
|
Set<String> servicesList = new HashSet<>();
|
||||||
servicesList.add(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString());
|
servicesList.add(ServicesMonitor.ServiceName.REMOTE_CASE_DATABASE.toString());
|
||||||
servicesList.add(ServicesMonitor.Service.REMOTE_KEYWORD_SEARCH.toString());
|
servicesList.add(ServicesMonitor.ServiceName.REMOTE_KEYWORD_SEARCH.toString());
|
||||||
this.servicesMonitor.addSubscriber(servicesList, propChangeListener);
|
this.servicesMonitor.addSubscriber(servicesList, propChangeListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user