public void close() throws IOException { FileUtils.close(dfile, ifile); }
public static void close(Closeable... cs) throws IOException { close(Arrays.asList(cs)); }
public static void close(Closeable... cs) throws IOException { close(Arrays.asList(cs)); }
public static void close(Closeable... cs) throws IOException { close(Arrays.asList(cs)); }
public static void close(Closeable... cs) throws IOException { close(Arrays.asList(cs)); }
public static void close(Closeable... cs) throws IOException { close(Arrays.asList(cs)); }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
FileUtils.close(is); conn.disconnect();
FileUtils.close(is); conn.disconnect();
public void close() { try { if (isClosed.compareAndSet(false, true)) FileUtils.close(dfile, ifile); } catch (IOException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, sstable.getFilename()); } }
public void close() { try { if (isClosed.compareAndSet(false, true)) FileUtils.close(dfile, ifile); } catch (IOException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, sstable.getFilename()); } }
public void close() { try { if (isClosed.compareAndSet(false, true)) FileUtils.close(dfile, ifile); } catch (IOException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, sstable.getFilename()); } }
public void close() { try { if (isClosed.compareAndSet(false, true)) FileUtils.close(dfile, ifile); } catch (IOException e) { sstable.markSuspect(); throw new CorruptSSTableException(e, sstable.getFilename()); } }