use of org.opendaylight.infrautils.diagstatus.ServiceDescriptor in project genius by opendaylight.
the class DatastoreServiceStatusProvider method getServiceDescriptor.
@Override
public ServiceDescriptor getServiceDescriptor() {
ServiceState dataStoreServiceState = ServiceState.ERROR;
String statusDesc;
Boolean operSyncStatusValue = (Boolean) MBeanUtils.readMBeanAttribute("org.opendaylight.controller:type=" + "DistributedOperationalDatastore,Category=ShardManager,name=shard-manager-operational", "SyncStatus");
Boolean configSyncStatusValue = (Boolean) MBeanUtils.readMBeanAttribute("org.opendaylight.controller:type=" + "DistributedConfigDatastore,Category=ShardManager,name=shard-manager-config", "SyncStatus");
if (operSyncStatusValue != null && configSyncStatusValue != null) {
if (operSyncStatusValue && configSyncStatusValue) {
dataStoreServiceState = ServiceState.OPERATIONAL;
statusDesc = dataStoreServiceState.name();
} else {
statusDesc = "datastore out of sync";
}
} else {
statusDesc = "Unable to obtain the datastore status";
}
return new ServiceDescriptor(DATASTORE_SERVICE_NAME, dataStoreServiceState, statusDesc);
}
use of org.opendaylight.infrautils.diagstatus.ServiceDescriptor in project infrautils by opendaylight.
the class DiagStatusServiceImpl method register.
@Override
public ServiceRegistration register(String serviceIdentifier) {
ServiceDescriptor serviceDescriptor = new ServiceDescriptor(serviceIdentifier, STARTING, "INITIALIZING");
statusMap.put(serviceIdentifier, serviceDescriptor);
return () -> {
if (statusMap.remove(serviceIdentifier) == null) {
throw new IllegalStateException("Service already unregistered");
}
};
}
use of org.opendaylight.infrautils.diagstatus.ServiceDescriptor in project infrautils by opendaylight.
the class DiagStatusServiceImpl method updateServiceStatusMap.
private void updateServiceStatusMap() {
for (ServiceStatusProvider serviceReference : serviceStatusProviders) {
ServiceDescriptor serviceDescriptor = serviceReference.getServiceDescriptor();
statusMap.put(serviceDescriptor.getModuleServiceName(), serviceDescriptor);
}
}
use of org.opendaylight.infrautils.diagstatus.ServiceDescriptor in project infrautils by opendaylight.
the class DiagStatusServiceMBeanImpl method acquireServiceStatusDetailed.
@Override
public String acquireServiceStatusDetailed() {
StringBuilder statusSummary = new StringBuilder();
statusSummary.append("System ready state: ").append(systemReadyMonitor.getSystemState()).append('\n');
for (ServiceDescriptor status : diagStatusService.getAllServiceDescriptors()) {
statusSummary.append(" ").append(String.format("%-20s%-20s", status.getModuleServiceName(), ": " + status.getServiceState())).append("\n");
}
return statusSummary.toString();
}
Aggregations