org.apache.cassandra.io.util.FileUtils.close()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中org.apache.cassandra.io.util.FileUtils.close()方法的一些代码示例,展示了FileUtils.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.close()方法的具体详情如下:
包路径:org.apache.cassandra.io.util.FileUtils
类名称:FileUtils
方法名:close

FileUtils.close介绍

暂无

代码示例

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

public void close() throws IOException
{
  FileUtils.close(dfile, ifile);
}

代码示例来源:origin: jsevellec/cassandra-unit

public static void close(Closeable... cs) throws IOException
{
  close(Arrays.asList(cs));
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

public static void close(Closeable... cs) throws IOException
{
  close(Arrays.asList(cs));
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public static void close(Closeable... cs) throws IOException
{
  close(Arrays.asList(cs));
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public static void close(Closeable... cs) throws IOException
{
  close(Arrays.asList(cs));
}

代码示例来源:origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public static void close(Closeable... cs) throws IOException
{
  close(Arrays.asList(cs));
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

String awsApiCall(String url) throws IOException, ConfigurationException
{
  // Populate the region and zone by introspection, fail if 404 on metadata
  HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
  DataInputStream d = null;
  try
  {
    conn.setRequestMethod("GET");
    if (conn.getResponseCode() != 200)
      throw new ConfigurationException("Ec2Snitch was unable to execute the API call. Not an ec2 node?");
    // Read the information. I wish I could say (String) conn.getContent() here...
    int cl = conn.getContentLength();
    byte[] b = new byte[cl];
    d = new DataInputStream((FilterInputStream) conn.getContent());
    d.readFully(b);
    return new String(b, StandardCharsets.UTF_8);
  }
  finally
  {
    FileUtils.close(d);
    conn.disconnect();
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

String gceApiCall(String url) throws IOException, ConfigurationException
{
  // Populate the region and zone by introspection, fail if 404 on metadata
  HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
  DataInputStream d = null;
  try
  {
    conn.setRequestMethod("GET");
  conn.setRequestProperty("Metadata-Flavor", "Google");
    if (conn.getResponseCode() != 200)
      throw new ConfigurationException("GoogleCloudSnitch was unable to execute the API call. Not a gce node?");
    // Read the information.
    int cl = conn.getContentLength();
    byte[] b = new byte[cl];
    d = new DataInputStream((FilterInputStream) conn.getContent());
    d.readFully(b);
    return new String(b, StandardCharsets.UTF_8);
  }
  finally
  {
    FileUtils.close(d);
    conn.disconnect();
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

String gceApiCall(String url) throws IOException, ConfigurationException
{
  // Populate the region and zone by introspection, fail if 404 on metadata
  HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
  DataInputStream d = null;
  try
  {
    conn.setRequestMethod("GET");
  conn.setRequestProperty("Metadata-Flavor", "Google");
    if (conn.getResponseCode() != 200)
      throw new ConfigurationException("GoogleCloudSnitch was unable to execute the API call. Not a gce node?");
    // Read the information.
    int cl = conn.getContentLength();
    byte[] b = new byte[cl];
    d = new DataInputStream((FilterInputStream) conn.getContent());
    d.readFully(b);
    return new String(b, StandardCharsets.UTF_8);
  }
  finally
  {
    FileUtils.close(d);
    conn.disconnect();
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

String awsApiCall(String url) throws IOException, ConfigurationException
{
  // Populate the region and zone by introspection, fail if 404 on metadata
  HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
  DataInputStream d = null;
  try
  {
    conn.setRequestMethod("GET");
    if (conn.getResponseCode() != 200)
      throw new ConfigurationException("Ec2Snitch was unable to execute the API call. Not an ec2 node?");
    // Read the information. I wish I could say (String) conn.getContent() here...
    int cl = conn.getContentLength();
    byte[] b = new byte[cl];
    d = new DataInputStream((FilterInputStream) conn.getContent());
    d.readFully(b);
    return new String(b, StandardCharsets.UTF_8);
  }
  finally
  {
    FileUtils.close(d);
    conn.disconnect();
  }
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

String gceApiCall(String url) throws IOException, ConfigurationException
{
  // Populate the region and zone by introspection, fail if 404 on metadata
  HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
  DataInputStream d = null;
  try
  {
    conn.setRequestMethod("GET");
  conn.setRequestProperty("Metadata-Flavor", "Google");
    if (conn.getResponseCode() != 200)
      throw new ConfigurationException("GoogleCloudSnitch was unable to execute the API call. Not a gce node?");
    // Read the information.
    int cl = conn.getContentLength();
    byte[] b = new byte[cl];
    d = new DataInputStream((FilterInputStream) conn.getContent());
    d.readFully(b);
    return new String(b, StandardCharsets.UTF_8);
  }
  finally
  {
    FileUtils.close(d);
    conn.disconnect();
  }
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

String awsApiCall(String url) throws IOException, ConfigurationException
{
  // Populate the region and zone by introspection, fail if 404 on metadata
  HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
  DataInputStream d = null;
  try
  {
    conn.setRequestMethod("GET");
    if (conn.getResponseCode() != 200)
      throw new ConfigurationException("Ec2Snitch was unable to execute the API call. Not an ec2 node?");
    // Read the information. I wish I could say (String) conn.getContent() here...
    int cl = conn.getContentLength();
    byte[] b = new byte[cl];
    d = new DataInputStream((FilterInputStream) conn.getContent());
    d.readFully(b);
    return new String(b, StandardCharsets.UTF_8);
  }
  finally
  {
    FileUtils.close(d);
    conn.disconnect();
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

String awsApiCall(String url) throws IOException, ConfigurationException
{
  // Populate the region and zone by introspection, fail if 404 on metadata
  HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
  DataInputStream d = null;
  try
  {
    conn.setRequestMethod("GET");
    if (conn.getResponseCode() != 200)
      throw new ConfigurationException("Ec2Snitch was unable to execute the API call. Not an ec2 node?");
    // Read the information. I wish I could say (String) conn.getContent() here...
    int cl = conn.getContentLength();
    byte[] b = new byte[cl];
    d = new DataInputStream((FilterInputStream) conn.getContent());
    d.readFully(b);
    return new String(b, StandardCharsets.UTF_8);
  }
  finally
  {
    FileUtils.close(d);
    conn.disconnect();
  }
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

String gceApiCall(String url) throws IOException, ConfigurationException
{
  // Populate the region and zone by introspection, fail if 404 on metadata
  HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
  DataInputStream d = null;
  try
  {
    conn.setRequestMethod("GET");
  conn.setRequestProperty("Metadata-Flavor", "Google");
    if (conn.getResponseCode() != 200)
      throw new ConfigurationException("GoogleCloudSnitch was unable to execute the API call. Not a gce node?");
    // Read the information.
    int cl = conn.getContentLength();
    byte[] b = new byte[cl];
    d = new DataInputStream((FilterInputStream) conn.getContent());
    d.readFully(b);
    return new String(b, StandardCharsets.UTF_8);
  }
  finally
  {
    FileUtils.close(d);
    conn.disconnect();
  }
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

FileUtils.close(is);
conn.disconnect();

代码示例来源:origin: jsevellec/cassandra-unit

FileUtils.close(is);
conn.disconnect();

代码示例来源:origin: org.apache.cassandra/cassandra-all

public void close()
{
  try
  {
    if (isClosed.compareAndSet(false, true))
      FileUtils.close(dfile, ifile);
  }
  catch (IOException e)
  {
    sstable.markSuspect();
    throw new CorruptSSTableException(e, sstable.getFilename());
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

public void close()
{
  try
  {
    if (isClosed.compareAndSet(false, true))
      FileUtils.close(dfile, ifile);
  }
  catch (IOException e)
  {
    sstable.markSuspect();
    throw new CorruptSSTableException(e, sstable.getFilename());
  }
}

代码示例来源:origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public void close()
{
  try
  {
    if (isClosed.compareAndSet(false, true))
      FileUtils.close(dfile, ifile);
  }
  catch (IOException e)
  {
    sstable.markSuspect();
    throw new CorruptSSTableException(e, sstable.getFilename());
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public void close()
{
  try
  {
    if (isClosed.compareAndSet(false, true))
      FileUtils.close(dfile, ifile);
  }
  catch (IOException e)
  {
    sstable.markSuspect();
    throw new CorruptSSTableException(e, sstable.getFilename());
  }
}

相关文章