public static void downloadResourcesAsSupervisor(String key, String localFile, ClientBlobStore cb, Map conf)
            throws KeyNotFoundException, IOException {
        if (cb instanceof NimbusBlobStore) {
            List<NimbusInfo> nimbusInfos = null;
            CuratorFramework zkClient = null;
            try {
                zkClient = BlobStoreUtils.createZKClient(conf);
                nimbusInfos = Lists.newArrayList(BlobStoreUtils.getNimbodesWithLatestSequenceNumberOfBlob(zkClient, key));
                Collections.shuffle(nimbusInfos);
            } catch (Exception e) {
                LOG.error("get available nimbus for blob key:{} error", e);
                return;
            } finally {
                if (zkClient != null) {
                    zkClient.close();
                    zkClient = null;
                }
            }
            for (NimbusInfo nimbusInfo : nimbusInfos) {
                try {
                    NimbusClient nimbusClient = new NimbusClient(conf, nimbusInfo.getHost(), nimbusInfo.getPort());
                    cb.setClient(conf, nimbusClient);
                } catch (TTransportException e) {
                    // ignore
                    continue;
                }
                LOG.info("download blob {} from nimbus {}:{}", key, nimbusInfo.getHost(), nimbusInfo.getPort());
                downloadResourcesAsSupervisorDirect(key, localFile, cb);
            }

        } else {
            downloadResourcesAsSupervisorDirect(key, localFile, cb);
        }
    }
public static void downloadResourcesAsSupervisor ( String key , String localFile , ClientBlobStore cb , Map conf ) throws KeyNotFoundException , IOException { if ( cb instanceof NimbusBlobStore ) { List < NimbusInfo > nimbusInfos = null ; CuratorFramework zkClient = null ; try { zkClient = BlobStoreUtils . createZKClient ( conf ) ; nimbusInfos = Lists . newArrayList ( BlobStoreUtils . getNimbodesWithLatestSequenceNumberOfBlob ( zkClient , key ) ) ; Collections . shuffle ( nimbusInfos ) ; } catch ( Exception e ) { LOG . error ( "get available nimbus for blob key:{} error" , e ) ; return ; } finally { if ( zkClient != null ) { zkClient . close ( ) ; zkClient = null ; } } for ( NimbusInfo nimbusInfo : nimbusInfos ) { try { NimbusClient nimbusClient = new NimbusClient ( conf , nimbusInfo . getHost ( ) , nimbusInfo . getPort ( ) ) ; cb . setClient ( conf , nimbusClient ) ; } catch ( TTransportException e ) { continue ; } LOG . info ( "download blob {} from nimbus {}:{}" , key , nimbusInfo . getHost ( ) , nimbusInfo . getPort ( ) ) ; downloadResourcesAsSupervisorDirect ( key , localFile , cb ) ; } } else { downloadResourcesAsSupervisorDirect ( key , localFile , cb ) ; } }
Meant to be called only by the supervisor for stormjar/stormconf/stormcode files.

@param key
@param localFile
@param cb
@throws KeyNotFoundException
@throws IOException