Package backtype.storm.utils

Examples of backtype.storm.utils.BufferFileInputStream


  }

  @Override
  public String beginFileDownload(String file) throws TException {
    BufferFileInputStream is = null;
    String id = null;
    try {
      is = new BufferFileInputStream(file);
      id = UUID.randomUUID().toString();
      data.getDownloaders().put(id, is);
    } catch (FileNotFoundException e) {
      LOG.error(e + "file:" + file + " not found");
    }
View Full Code Here


          "Could not find input stream for that id");
    }
    byte[] ret = null;
    try {
      if(obj instanceof BufferFileInputStream){
        BufferFileInputStream is=(BufferFileInputStream) obj;
        ret=is.read();
        if (ret != null) {
          downloaders.put(id, (BufferFileInputStream) is);
        }
      }
    } catch (IOException e) {
View Full Code Here

    public static String submitJar(Map conf, String localJar) {
        NimbusClient client = NimbusClient.getConfiguredClient(conf);
        try {
            String uploadLocation = client.getClient().beginFileUpload();
            LOG.info("Uploading topology jar " + localJar + " to assigned location: " + uploadLocation);
            BufferFileInputStream is = new BufferFileInputStream(localJar);
            while(true) {
                byte[] toSubmit = is.read();
                if(toSubmit.length==0) break;
                client.getClient().uploadChunk(uploadLocation, ByteBuffer.wrap(toSubmit));
            }
            client.getClient().finishFileUpload(uploadLocation);
            LOG.info("Successfully uploaded topology jar to assigned location: " + uploadLocation);
View Full Code Here

          if (val!=null) {
            if(val instanceof Channel){
              Channel channel = (Channel) val;
              channel.close();   
            }else if(val instanceof BufferFileInputStream){
              BufferFileInputStream is=(BufferFileInputStream)val;
              is.close();
            }
          }
        } catch (IOException e) {
          LOG.error(e.getMessage(), e);
       
View Full Code Here

        NimbusClient client = NimbusClient.getConfiguredClient(conf);
        try {
            String uploadLocation = client.getClient().beginFileUpload();
            LOG.info("Uploading topology jar " + localJar + " to assigned location: " + uploadLocation);
            BufferFileInputStream is = new BufferFileInputStream(localJar, THRIFT_CHUNK_SIZE_BYTES);

            long totalSize = new File(localJar).length();
            if (listener != null) {
                listener.onStart(localJar, uploadLocation, totalSize);
            }

            long bytesUploaded = 0;
            while(true) {
                byte[] toSubmit = is.read();
                bytesUploaded += toSubmit.length;
                if (listener != null) {
                    listener.onProgress(localJar, uploadLocation, bytesUploaded, totalSize);
                }
View Full Code Here

        }
        NimbusClient client = NimbusClient.getConfiguredClient(conf);
        try {
            String uploadLocation = client.getClient().beginFileUpload();
            LOG.info("Uploading topology jar " + localJar + " to assigned location: " + uploadLocation);
            BufferFileInputStream is = new BufferFileInputStream(localJar);
            while(true) {
                byte[] toSubmit = is.read();
                if(toSubmit.length==0) break;
                client.getClient().uploadChunk(uploadLocation, ByteBuffer.wrap(toSubmit));
            }
            client.getClient().finishFileUpload(uploadLocation);
            LOG.info("Successfully uploaded topology jar to assigned location: " + uploadLocation);
View Full Code Here

        NimbusClient client = NimbusClient.getConfiguredClient(conf);
        try {
            String uploadLocation = client.getClient().beginFileUpload();
            LOG.info("Uploading topology jar " + localJar + " to assigned location: " + uploadLocation);
            BufferFileInputStream is = new BufferFileInputStream(localJar, THRIFT_CHUNK_SIZE_BYTES);

            long totalSize = new File(localJar).length();
            if (listener != null) {
                listener.onStart(localJar, uploadLocation, totalSize);
            }

            long bytesUploaded = 0;
            while(true) {
                byte[] toSubmit = is.read();
                bytesUploaded += toSubmit.length;
                if (listener != null) {
                    listener.onProgress(localJar, uploadLocation, bytesUploaded, totalSize);
                }
View Full Code Here

        }
        NimbusClient client = NimbusClient.getConfiguredClient(conf);
        try {
            String uploadLocation = client.getClient().beginFileUpload();
            LOG.info("Uploading topology jar " + localJar + " to assigned location: " + uploadLocation);
            BufferFileInputStream is = new BufferFileInputStream(localJar);
            while(true) {
                byte[] toSubmit = is.read();
                if(toSubmit.length==0) break;
                client.getClient().uploadChunk(uploadLocation, ByteBuffer.wrap(toSubmit));
            }
            client.getClient().finishFileUpload(uploadLocation);
            LOG.info("Successfully uploaded topology jar to assigned location: " + uploadLocation);
View Full Code Here

          .get(Config.NIMBUS_THRIFT_MAX_BUFFER_SIZE);
      if (maxBufSizeObject != null) {
        bufferSize = Utils.getInt(maxBufSizeObject) / 2;
      }

      BufferFileInputStream is = new BufferFileInputStream(localJar,
          bufferSize);
      while (true) {
        byte[] toSubmit = is.read();
        if (toSubmit.length == 0)
          break;
        client.getClient().uploadChunk(uploadLocation,
            ByteBuffer.wrap(toSubmit));
      }
View Full Code Here

          if (val != null) {
            if (val instanceof Channel) {
              Channel channel = (Channel) val;
              channel.close();
            } else if (val instanceof BufferFileInputStream) {
              BufferFileInputStream is = (BufferFileInputStream) val;
              is.close();
            }
          }
        } catch (IOException e) {
          LOG.error(e.getMessage(), e);
        }
View Full Code Here

TOP

Related Classes of backtype.storm.utils.BufferFileInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.