1 Reply Latest reply on Feb 9, 2004 1:03 PM by slbain

    Relation Service

    slbain

      JMX - Relation Service.
      I have been using the test cases for the JMX - Relation Service implementation in JBoss 3.2.3 to create Relations among MBeans.

      When working with internal relations I found that if a role value MBean was unregistered in the MBeanServer the associated Role.roleValues did not reflect the de-registration of the MBean, i.e. the MBean ObjectName was still a member of the List returned by RelationService.getRole(String theRelId, String theRoleName) method.

      Based upon my understanding I expected that the list would not have contained this reference since the RelationService is responsible for maintaining the internal consistency. Is this understanding correct ?

      sinclair

        • 1. Re: Relation Service
          slbain

          Further,
          In the RelationSupport class #handleMBeanUnregistration() method
          it looks as though the Role.roleValues are not being modified to reflect the removal.

           handleMBeanUnregistration(ObjectName objectName, String roleName) throws ... {
          
           checkRegistered();
           Role role = validateRoleFound(roleName);
          // sb: role.getRoleValue() implementation returns a copy
           ArrayList values = (ArrayList) role.getRoleValue();
           ArrayList oldRoleValue = new ArrayList(values);
          // sb: this updates the copy
           if (values.remove(objectName) == false)
           throw new InvalidRoleValueException("...");
          // sb: thus the role state is intact ?
           updateRole(role, oldRoleValue);
          }
          


          By adding an call to #setRoleValues() as below

           Role role = validateRoleFound(roleName);
           ArrayList values = (ArrayList) role.getRoleValue();
           ArrayList oldRoleValue = new ArrayList(values);
           if (values.remove(objectName) == false)
           throw new InvalidRoleValueException("...");
          // sb: added
           role.setRoleValue(values);
          // end added
           updateRole(role, oldRoleValue);
          


          it is possible to capture the change for downstream processing.

          I am not sure whether this is the correct/best place to apply the update to the Role instance within the processing context however it would appear to be the most opportune in the call sequence.

          Hope this helps,
          sinclair
          panacya inc.