public static DistributedLockServiceMXBean getDistributedLockMbean(final String lockServiceName,
      final int expectedMembers) {
    DistributedLockServiceMXBean bean = null;

    final ManagementService service = ManagementTestBase.getManagementService();
    Wait.waitForCriterion(new WaitCriterion() {

      DistributedLockServiceMXBean bean = null;

      @Override
      public String description() {
        return "Waiting for " + expectedMembers + " proxies to get reflected at managing node";
      }

      @Override
      public boolean done() {
        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
        bean = service.getDistributedLockServiceMXBean(lockServiceName);
        boolean done = (bean != null && bean.getMemberCount() == expectedMembers);
        return done;
      }

    }, MAX_WAIT, 500, true);

    bean = service.getDistributedLockServiceMXBean(lockServiceName);
    return bean;
  }
Utility Method to obtain DistributedRegionMXBean proxy reference for a particular region

@param lockServiceName name of the lock service
@param expectedMembers the number of members expected to be using the lock service
@return a reference to DistributedLockServiceMXBean
geode-dunit/src/main/java/org/apache/geode/management/MBeanUtil.java