From 880f98d940730b0d987c653fdc9fe64b1c8d4dce Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Fri, 8 Jun 2018 11:54:02 +0200 Subject: [PATCH] report exceptions from datastore service with cause (INFRAUTILS-31) JIRA: GENIUS-138 Change-Id: Ie0a9f6edeb69e2d4164c51d8340bd4f4a89aefab Signed-off-by: Michael Vorburger --- .../internal/DatastoreServiceStatusProvider.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/mdsalutil/mdsalutil-impl/src/main/java/org/opendaylight/genius/mdsalutil/diagstatus/internal/DatastoreServiceStatusProvider.java b/mdsalutil/mdsalutil-impl/src/main/java/org/opendaylight/genius/mdsalutil/diagstatus/internal/DatastoreServiceStatusProvider.java index 471e85fdd..3c2b0607e 100644 --- a/mdsalutil/mdsalutil-impl/src/main/java/org/opendaylight/genius/mdsalutil/diagstatus/internal/DatastoreServiceStatusProvider.java +++ b/mdsalutil/mdsalutil-impl/src/main/java/org/opendaylight/genius/mdsalutil/diagstatus/internal/DatastoreServiceStatusProvider.java @@ -46,9 +46,9 @@ public class DatastoreServiceStatusProvider implements ServiceStatusProvider { @Override public ServiceDescriptor getServiceDescriptor() { - ServiceState dataStoreServiceState; - String statusDesc; try { + ServiceState dataStoreServiceState; + String statusDesc; Boolean operSyncStatusValue = (Boolean) MBeanUtils.getMBeanAttribute("org.opendaylight.controller:type=" + "DistributedOperationalDatastore,Category=ShardManager,name=shard-manager-operational", "SyncStatus"); @@ -67,14 +67,10 @@ public class DatastoreServiceStatusProvider implements ServiceStatusProvider { dataStoreServiceState = ServiceState.ERROR; statusDesc = "Unable to obtain the datastore status (getMBeanAttribute returned null?!)"; } + return new ServiceDescriptor(DATASTORE_SERVICE_NAME, dataStoreServiceState, statusDesc); } catch (JMException e) { LOG.error("Unable to obtain the datastore status due to JMException", e); - dataStoreServiceState = ServiceState.ERROR; - statusDesc = "Unable to obtain the datastore status: " + e.getMessage(); - // TODO use https://jira.opendaylight.org/browse/INFRAUTILS-31 here when available - // to report the details of the root cause of the JMX problem to diagstatus consumers. + return new ServiceDescriptor(DATASTORE_SERVICE_NAME, e); } - - return new ServiceDescriptor(DATASTORE_SERVICE_NAME, dataStoreServiceState, statusDesc); } } -- 2.36.6