public ConfigurationResponse createConfigurationReponse(final ConfigurationRequest configRequest) throws Exception {
  ConfigurationResponse configResponse=new ConfigurationResponse();
  for (int i=0; i < configRequest.getNumAttempts(); i++) {
    boolean isLocked=sharedConfigLockingService.lock(SHARED_CONFIG_LOCK_NAME,5000,5000);
    try {
      if (isLocked) {
        Set<String> groups=configRequest.getGroups();
        groups.add(SharedConfiguration.CLUSTER_CONFIG);
        logger.info("Building up configuration response with following configurations: {}",groups);
        for (        String group : groups) {
          Configuration configuration=getConfiguration(group);
          configResponse.addConfiguration(configuration);
        }
        Object[] jars=getAllJars(groups);
        if (jars != null) {
          String[] jarNames=(String[])jars[0];
          byte[][] jarBytes=(byte[][])jars[1];
          configResponse.addJarsToBeDeployed(jarNames,jarBytes);
        }
        configResponse.setFailedToGetSharedConfig(false);
        return configResponse;
      }
    }
  finally {
      sharedConfigLockingService.unlock(SHARED_CONFIG_LOCK_NAME);
    }
  }
  configResponse.setFailedToGetSharedConfig(true);
  return configResponse;
}

public ConfigurationResponse createConfigurationReponse ( final ConfigurationRequest configRequest ) throws Exception { ConfigurationResponse configResponse = new ConfigurationResponse ( ) ; for ( int i = 0 ; i < configRequest . getNumAttempts ( ) ; i ++ ) { boolean isLocked = sharedConfigLockingService . lock ( SHARED_CONFIG_LOCK_NAME , 5000 , 5000 ) ; try { if ( isLocked ) { Set < String > groups = configRequest . getGroups ( ) ; groups . add ( SharedConfiguration . CLUSTER_CONFIG ) ; logger . info ( "Building up configuration response with following configurations: {}" , groups ) ; for ( String group : groups ) { Configuration configuration = getConfiguration ( group ) ; configResponse . addConfiguration ( configuration ) ; } Object [ ] jars = getAllJars ( groups ) ; if ( jars != null ) { String [ ] jarNames = ( String [ ] ) jars [ 0 ] ; byte [ ] [ ] jarBytes = ( byte [ ] [ ] ) jars [ 1 ] ; configResponse . addJarsToBeDeployed ( jarNames , jarBytes ) ; } configResponse . setFailedToGetSharedConfig ( false ) ; return configResponse ; } } finally { sharedConfigLockingService . unlock ( SHARED_CONFIG_LOCK_NAME ) ; } } configResponse . setFailedToGetSharedConfig ( true ) ; return configResponse ; }
creates a configurationresponse based on the configrequest , configuration response contains the requested shared configuration this method locks the sharedconfiguration
