Package org.apache.thrift7.transport

Examples of org.apache.thrift7.transport.TSocket


      LOG.error(errMsg, e);
      throw new NotAliveException(errMsg);
    } catch (Exception e) {
      String errMsg = "Failed to active topology " + topologyName;
      LOG.error(errMsg, e);
      throw new TException(errMsg);
    }

  }
View Full Code Here


      LOG.error(errMsg, e);
      throw new NotAliveException(errMsg);
    } catch (Exception e) {
      String errMsg = "Failed to deactivate topology " + topologyName;
      LOG.error(errMsg, e);
      throw new TException(errMsg);
    }

  }
View Full Code Here

      LOG.error(errMsg, e);
      throw new NotAliveException(errMsg);
    } catch (Exception e) {
      String errMsg = "Failed to rebalance topology " + topologyName;
      LOG.error(errMsg, e);
      throw new TException(errMsg);
    }

  }
View Full Code Here

          Channels.newChannel(new FileOutputStream(libName)));
      LOG.info("Begin upload file from client to " + libName);
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      LOG.error("Fail to upload jar " + libName, e);
      throw new TException(e);
    }
  }
View Full Code Here

          Channels.newChannel(new FileOutputStream(fileLoc)));
      LOG.info("Begin upload file from client to " + fileLoc);
      return path;
    } catch (FileNotFoundException e) {
      LOG.error("File not found: " + fileLoc, e);
      throw new TException(e);
    } catch (IOException e) {
      LOG.error("Upload file error: " + fileLoc, e);
      throw new TException(e);
    }
  }
View Full Code Here

  public void uploadChunk(String location, ByteBuffer chunk)
      throws TException {
    TimeCacheMap<Object, Object> uploaders = data.getUploaders();
    Object obj = uploaders.get(location);
    if (obj == null) {
      throw new TException(
          "File for that location does not exist (or timed out) "
              + location);
    }
    try {
      if (obj instanceof WritableByteChannel) {
        WritableByteChannel channel = (WritableByteChannel) obj;
        channel.write(chunk);
        uploaders.put(location, channel);
      } else {
        throw new TException("Object isn't WritableByteChannel for "
            + location);
      }
    } catch (IOException e) {
      String errMsg = " WritableByteChannel write filed when uploadChunk "
          + location;
      LOG.error(errMsg);
      throw new TException(e);
    }

  }
View Full Code Here

  public void finishFileUpload(String location) throws TException {

    TimeCacheMap<Object, Object> uploaders = data.getUploaders();
    Object obj = uploaders.get(location);
    if (obj == null) {
      throw new TException(
          "File for that location does not exist (or timed out)");
    }
    try {
      if (obj instanceof WritableByteChannel) {
        WritableByteChannel channel = (WritableByteChannel) obj;
        channel.close();
        uploaders.remove(location);
        LOG.info("Finished uploading file from client: " + location);
      } else {
        throw new TException("Object isn't WritableByteChannel for "
            + location);
      }
    } catch (IOException e) {
      LOG.error(" WritableByteChannel close failed when finishFileUpload "
          + location);
View Full Code Here

      is = new BufferFileInputStream(file, bufferSize);
      id = UUID.randomUUID().toString();
      data.getDownloaders().put(id, is);
    } catch (FileNotFoundException e) {
      LOG.error(e + "file:" + file + " not found");
      throw new TException(e);
    }

    return id;
  }
View Full Code Here

  @Override
  public ByteBuffer downloadChunk(String id) throws TException {
    TimeCacheMap<Object, Object> downloaders = data.getDownloaders();
    Object obj = downloaders.get(id);
    if (obj == null) {
      throw new TException("Could not find input stream for that id");
    }

    try {
      if (obj instanceof BufferFileInputStream) {

        BufferFileInputStream is = (BufferFileInputStream) obj;
        byte[] ret = is.read();
        if (ret != null) {
          downloaders.put(id, (BufferFileInputStream) is);
          return ByteBuffer.wrap(ret);
        }
      } else {
        throw new TException("Object isn't BufferFileInputStream for "
            + id);
      }
    } catch (IOException e) {
      LOG.error("BufferFileInputStream read failed when downloadChunk ",
          e);
      throw new TException(e);
    }
    byte[] empty = {};
    return ByteBuffer.wrap(empty);
  }
View Full Code Here

    } catch (TException e) {
      LOG.info("Failed to get ClusterSummary ", e);
      throw e;
    } catch (Exception e) {
      LOG.info("Failed to get ClusterSummary ", e);
      throw new TException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.thrift7.transport.TSocket

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.