当前位置: 首页>>代码示例>>Java>>正文


Java BufferSizeParam.getValue方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.web.resources.BufferSizeParam.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java BufferSizeParam.getValue方法的具体用法?Java BufferSizeParam.getValue怎么用?Java BufferSizeParam.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.web.resources.BufferSizeParam的用法示例。


在下文中一共展示了BufferSizeParam.getValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: post

import org.apache.hadoop.hdfs.web.resources.BufferSizeParam; //导入方法依赖的package包/类
private Response post(
    final InputStream in,
    final String nnId,
    final String fullpath,
    final PostOpParam op,
    final BufferSizeParam bufferSize
    ) throws IOException {
  final DataNode datanode = (DataNode)context.getAttribute("datanode");

  switch(op.getValue()) {
  case APPEND:
  {
    final Configuration conf = new Configuration(datanode.getConf());
    final int b = bufferSize.getValue(conf);
    DFSClient dfsclient = newDfsClient(nnId, conf);
    FSDataOutputStream out = null;
    try {
      out = dfsclient.append(fullpath, b, null, null);
      IOUtils.copyBytes(in, out, b);
      out.close();
      out = null;
      dfsclient.close();
      dfsclient = null;
    } finally {
      IOUtils.cleanup(LOG, out);
      IOUtils.cleanup(LOG, dfsclient);
    }
    return Response.ok().type(MediaType.APPLICATION_OCTET_STREAM).build();
  }
  default:
    throw new UnsupportedOperationException(op + " is not supported");
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:34,代码来源:DatanodeWebHdfsMethods.java

示例2: post

import org.apache.hadoop.hdfs.web.resources.BufferSizeParam; //导入方法依赖的package包/类
private Response post(
    final InputStream in,
    final UserGroupInformation ugi,
    final DelegationParam delegation,
    final InetSocketAddress nnRpcAddr,
    final String fullpath,
    final PostOpParam op,
    final BufferSizeParam bufferSize
    ) throws IOException {
  final DataNode datanode = (DataNode)context.getAttribute("datanode");

  switch(op.getValue()) {
  case APPEND:
  {
    final Configuration conf = new Configuration(datanode.getConf());
    final int b = bufferSize.getValue(conf);
    DFSClient dfsclient = new DFSClient(nnRpcAddr, conf);
    FSDataOutputStream out = null;
    try {
      out = dfsclient.append(fullpath, b, null, null);
      IOUtils.copyBytes(in, out, b);
      out.close();
      out = null;
      dfsclient.close();
      dfsclient = null;
    } finally {
      IOUtils.cleanup(LOG, out);
      IOUtils.cleanup(LOG, dfsclient);
    }
    return Response.ok().type(MediaType.APPLICATION_OCTET_STREAM).build();
  }
  default:
    throw new UnsupportedOperationException(op + " is not supported");
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:36,代码来源:DatanodeWebHdfsMethods.java

示例3: post

import org.apache.hadoop.hdfs.web.resources.BufferSizeParam; //导入方法依赖的package包/类
private Response post(final InputStream in, final UserGroupInformation ugi,
    final DelegationParam delegation, final InetSocketAddress nnRpcAddr,
    final String fullpath, final PostOpParam op,
    final BufferSizeParam bufferSize) throws IOException {
  final DataNode datanode = (DataNode) context.getAttribute("datanode");

  switch (op.getValue()) {
    case APPEND: {
      final Configuration conf = new Configuration(datanode.getConf());
      final int b = bufferSize.getValue(conf);
      DFSClient dfsclient = new DFSClient(nnRpcAddr, conf);
      FSDataOutputStream out = null;
      try {
        out = dfsclient.append(fullpath, b, null, null);
        IOUtils.copyBytes(in, out, b);
        out.close();
        out = null;
        dfsclient.close();
        dfsclient = null;
      } finally {
        IOUtils.cleanup(LOG, out);
        IOUtils.cleanup(LOG, dfsclient);
      }
      return Response.ok().type(MediaType.APPLICATION_OCTET_STREAM).build();
    }
    default:
      throw new UnsupportedOperationException(op + " is not supported");
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:30,代码来源:DatanodeWebHdfsMethods.java

示例4: put

import org.apache.hadoop.hdfs.web.resources.BufferSizeParam; //导入方法依赖的package包/类
private Response put(
    final InputStream in,
    final String nnId,
    final String fullpath,
    final PutOpParam op,
    final PermissionParam permission,
    final OverwriteParam overwrite,
    final BufferSizeParam bufferSize,
    final ReplicationParam replication,
    final BlockSizeParam blockSize
    ) throws IOException, URISyntaxException {
  final DataNode datanode = (DataNode)context.getAttribute("datanode");

  switch(op.getValue()) {
  case CREATE:
  {
    final Configuration conf = new Configuration(datanode.getConf());
    conf.set(FsPermission.UMASK_LABEL, "000");

    final int b = bufferSize.getValue(conf);
    DFSClient dfsclient = newDfsClient(nnId, conf);
    FSDataOutputStream out = null;
    try {
      out = dfsclient.createWrappedOutputStream(dfsclient.create(
          fullpath, permission.getFsPermission(), 
          overwrite.getValue() ?
              EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE) :
              EnumSet.of(CreateFlag.CREATE),
          replication.getValue(conf), blockSize.getValue(conf), null,
          b, null), null);
      IOUtils.copyBytes(in, out, b);
      out.close();
      out = null;
      dfsclient.close();
      dfsclient = null;
    } finally {
      IOUtils.cleanup(LOG, out);
      IOUtils.cleanup(LOG, dfsclient);
    }
    final String scheme = "http".equals(request.getScheme()) ?
    WebHdfsFileSystem.SCHEME : SWebHdfsFileSystem.SCHEME;
    final URI uri = new URI(scheme, nnId, fullpath, null, null);
    return Response.created(uri).type(MediaType.APPLICATION_OCTET_STREAM).build();
  }
  default:
    throw new UnsupportedOperationException(op + " is not supported");
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:49,代码来源:DatanodeWebHdfsMethods.java

示例5: put

import org.apache.hadoop.hdfs.web.resources.BufferSizeParam; //导入方法依赖的package包/类
private Response put(
    final InputStream in,
    final UserGroupInformation ugi,
    final DelegationParam delegation,
    final InetSocketAddress nnRpcAddr,
    final String fullpath,
    final PutOpParam op,
    final PermissionParam permission,
    final OverwriteParam overwrite,
    final BufferSizeParam bufferSize,
    final ReplicationParam replication,
    final BlockSizeParam blockSize
    ) throws IOException, URISyntaxException {
  final DataNode datanode = (DataNode)context.getAttribute("datanode");

  switch(op.getValue()) {
  case CREATE:
  {
    final Configuration conf = new Configuration(datanode.getConf());
    conf.set(FsPermission.UMASK_LABEL, "000");

    final int b = bufferSize.getValue(conf);
    DFSClient dfsclient = new DFSClient(nnRpcAddr, conf);
    FSDataOutputStream out = null;
    try {
      out = new FSDataOutputStream(dfsclient.create(
          fullpath, permission.getFsPermission(), 
          overwrite.getValue() ? EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE)
              : EnumSet.of(CreateFlag.CREATE),
          replication.getValue(conf), blockSize.getValue(conf), null, b, null), null);
      IOUtils.copyBytes(in, out, b);
      out.close();
      out = null;
      dfsclient.close();
      dfsclient = null;
    } finally {
      IOUtils.cleanup(LOG, out);
      IOUtils.cleanup(LOG, dfsclient);
    }
    final InetSocketAddress nnHttpAddr = NameNode.getHttpAddress(conf);
    final URI uri = new URI(WebHdfsFileSystem.SCHEME, null,
        nnHttpAddr.getHostName(), nnHttpAddr.getPort(), fullpath, null, null);
    return Response.created(uri).type(MediaType.APPLICATION_OCTET_STREAM).build();
  }
  default:
    throw new UnsupportedOperationException(op + " is not supported");
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:49,代码来源:DatanodeWebHdfsMethods.java

示例6: put

import org.apache.hadoop.hdfs.web.resources.BufferSizeParam; //导入方法依赖的package包/类
private Response put(final InputStream in, final UserGroupInformation ugi,
    final DelegationParam delegation, final InetSocketAddress nnRpcAddr,
    final String fullpath, final PutOpParam op,
    final PermissionParam permission, final OverwriteParam overwrite,
    final BufferSizeParam bufferSize, final ReplicationParam replication,
    final BlockSizeParam blockSize) throws IOException, URISyntaxException {
  final DataNode datanode = (DataNode) context.getAttribute("datanode");

  switch (op.getValue()) {
    case CREATE: {
      final Configuration conf = new Configuration(datanode.getConf());
      conf.set(FsPermission.UMASK_LABEL, "000");

      final int b = bufferSize.getValue(conf);
      DFSClient dfsclient = new DFSClient(nnRpcAddr, conf);
      FSDataOutputStream out = null;
      try {
        out = new FSDataOutputStream(dfsclient
            .create(fullpath, permission.getFsPermission(),
                overwrite.getValue() ?
                    EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE) :
                    EnumSet.of(CreateFlag.CREATE), replication.getValue(conf),
                blockSize.getValue(conf), null, b, null), null);
        IOUtils.copyBytes(in, out, b);
        out.close();
        out = null;
        dfsclient.close();
        dfsclient = null;
      } finally {
        IOUtils.cleanup(LOG, out);
        IOUtils.cleanup(LOG, dfsclient);
      }
      final InetSocketAddress nnHttpAddr = NameNode.getHttpAddress(conf);
      final URI uri =
          new URI(WebHdfsFileSystem.SCHEME, null, nnHttpAddr.getHostName(),
              nnHttpAddr.getPort(), fullpath, null, null);
      return Response.created(uri).type(MediaType.APPLICATION_OCTET_STREAM)
          .build();
    }
    default:
      throw new UnsupportedOperationException(op + " is not supported");
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:44,代码来源:DatanodeWebHdfsMethods.java

示例7: put

import org.apache.hadoop.hdfs.web.resources.BufferSizeParam; //导入方法依赖的package包/类
private Response put(
    final InputStream in,
    final String nnId,
    final String fullpath,
    final PutOpParam op,
    final PermissionParam permission,
    final OverwriteParam overwrite,
    final BufferSizeParam bufferSize,
    final ReplicationParam replication,
    final BlockSizeParam blockSize
    ) throws IOException, URISyntaxException {
  final DataNode datanode = (DataNode)context.getAttribute("datanode");

  switch(op.getValue()) {
  case CREATE:
  {
    final Configuration conf = new Configuration(datanode.getConf());
    conf.set(FsPermission.UMASK_LABEL, "000");

    final int b = bufferSize.getValue(conf);
    DFSClient dfsclient = newDfsClient(nnId, conf);
    FSDataOutputStream out = null;
    try {
      out = new FSDataOutputStream(dfsclient.create(
          fullpath, permission.getFsPermission(), 
          overwrite.getValue() ? EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE)
              : EnumSet.of(CreateFlag.CREATE),
          replication.getValue(conf), blockSize.getValue(conf), null, b, null), null);
      IOUtils.copyBytes(in, out, b);
      out.close();
      out = null;
      dfsclient.close();
      dfsclient = null;
    } finally {
      IOUtils.cleanup(LOG, out);
      IOUtils.cleanup(LOG, dfsclient);
    }
    final String scheme = "http".equals(request.getScheme()) ?
    WebHdfsFileSystem.SCHEME : SWebHdfsFileSystem.SCHEME;
    final URI uri = new URI(scheme, nnId, fullpath, null, null);
    return Response.created(uri).type(MediaType.APPLICATION_OCTET_STREAM).build();
  }
  default:
    throw new UnsupportedOperationException(op + " is not supported");
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:47,代码来源:DatanodeWebHdfsMethods.java


注:本文中的org.apache.hadoop.hdfs.web.resources.BufferSizeParam.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。