Pārlūkot izejas kodu

AMBARI-11588. NPE on desiredStateEntity from different stack traces in ServiceComponentHostImpl. (mpapirkovskyy)

Myroslav Papirkovskyy 10 gadi atpakaļ
vecāks
revīzija
94e9657165

+ 9 - 9
ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java

@@ -799,7 +799,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   public String getVersion() {
     readLock.lock();
     try {
-      return getStateEntity().getVersion();
+      return stateEntity.getVersion();
     } finally {
       readLock.unlock();
     }
@@ -820,7 +820,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   public SecurityState getSecurityState() {
     readLock.lock();
     try {
-      return getStateEntity().getSecurityState();
+      return stateEntity.getSecurityState();
     } finally {
       readLock.unlock();
     }
@@ -841,7 +841,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   public SecurityState getDesiredSecurityState() {
     readLock.lock();
     try {
-      return getDesiredStateEntity().getSecurityState();
+      return desiredStateEntity.getSecurityState();
     } finally {
       readLock.unlock();
     }
@@ -1026,7 +1026,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   public StackId getStackVersion() {
     readLock.lock();
     try {
-      HostComponentStateEntity schStateEntity = getStateEntity();
+      HostComponentStateEntity schStateEntity = stateEntity;
       if (schStateEntity == null) {
         return new StackId();
       }
@@ -1057,7 +1057,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   public State getDesiredState() {
     readLock.lock();
     try {
-      return getDesiredStateEntity().getDesiredState();
+      return desiredStateEntity.getDesiredState();
     } finally {
       readLock.unlock();
     }
@@ -1078,7 +1078,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   public StackId getDesiredStackVersion() {
     readLock.lock();
     try {
-      StackEntity desiredStackEntity = getDesiredStateEntity().getDesiredStack();
+      StackEntity desiredStackEntity = desiredStateEntity.getDesiredStack();
       return new StackId(desiredStackEntity.getStackName(),
           desiredStackEntity.getStackVersion());
     } finally {
@@ -1104,7 +1104,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   public HostComponentAdminState getComponentAdminState() {
     readLock.lock();
     try {
-      HostComponentAdminState adminState = getDesiredStateEntity().getAdminState();
+      HostComponentAdminState adminState = desiredStateEntity.getAdminState();
       if (adminState == null && !serviceComponent.isClientComponent()
           && !serviceComponent.isMasterComponent()) {
         adminState = HostComponentAdminState.INSERVICE;
@@ -1445,7 +1445,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   public MaintenanceState getMaintenanceState() {
     readLock.lock();
     try {
-      return getDesiredStateEntity().getMaintenanceState();
+      return desiredStateEntity.getMaintenanceState();
     } finally {
       readLock.unlock();
     }
@@ -1475,7 +1475,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
   public boolean isRestartRequired() {
     readLock.lock();
     try {
-      return getDesiredStateEntity().isRestartRequired();
+      return desiredStateEntity.isRestartRequired();
     } finally {
       readLock.unlock();
     }