docs: @Override
      public List<ServiceInstance> getAllInstancesByKey(ServiceInstanceQuery query)
              throws ServiceException {
          if(! isStarted){
              ServiceDirectoryError error = new ServiceDirectoryError(ErrorCode.SERVICE_DIRECTORY_MANAGER_FACTORY_CLOSED);
              throw new ServiceException(error);
          }
  //        validateServiceInstanceQuery(query);
          if(query == null ){
              throw new IllegalArgumentException("ServiceInstanceQuery cannot be null.");
          }
  
          if(query.getCriteria() == null || query.getCriteria().size() == 0){
              return Collections.emptyList();
          }
  
          List<ServiceInstance> instances = null;
  
          List<ModelServiceInstance> modelInstances = getLookupService().queryModelInstances(query);
          if(modelInstances != null && modelInstances.size()> 0){
              instances = new ArrayList<ServiceInstance>();
              for(ModelServiceInstance model : modelInstances){
                  instances.add(ServiceInstanceUtils
                          .transferFromModelServiceInstance(model));
              }
          }
  
          if (instances != null) {
              return instances;
          } else {
              return Collections.emptyList();
          }
      }