/** * Close this executor. */ @Override public void close() { IOUtils.closeQuietly(socketOut); IOUtils.closeQuietly(socketIn); IOUtils.closeQuietly(socket); }
public void shutDown() throws Exception { if (!initialized) { return; } if (blobStoreNeedsClose && bs instanceof Closeable) { IOUtils.closeQuietly((Closeable) bs); } if (rs instanceof Closeable) { IOUtils.closeQuietly((Closeable) rs); } initialized = false; }
@Deactivate public void deactivate() { closeQuietly(closer); }
@Deactivate public void deactivate() { closeQuietly(registrations); }
@Override public void removedService(ServiceReference reference, Object service) { Closeable subscription = subscriptions.remove(reference); if (subscription != null) { closeQuietly(subscription); bundleContext.ungetService(reference); } }
@Override public void removedService(ServiceReference reference, Object service) { Closeable subscription = subscriptions.remove(reference); if (subscription != null) { closeQuietly(subscription); bundleContext.ungetService(reference); } }
public void close() { verifyInitialized(); if (gcExecutor != null) { gcExecutor.shutdown(); } cache.invalidateAll(); IOUtils.closeQuietly(pm); initialized = false; }
@Override public void close() throws IOException { committed = true; try { sendHeaders(); IOUtils.closeQuietly(respOut); if (out != null) { out.flush(); } } finally { out = null; } }
@Override public void close() { if (in != null) { try { // Consume a possibly non-empty body by triggering the // creation of our request input stream getInputStream(); IOUtils.closeQuietly(reqIn); } finally { in = null; } } } }
private static String toHex(byte[] bytes) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { HexDump.dump(bytes, 0, out, 0); return out.toString(Charsets.UTF_8.name()); } catch (IOException e) { return "Error dumping segment: " + e.getMessage(); } finally { closeQuietly(out); } }
@Override public String write(InputStream in) throws MicroKernelException { Request request = null; try { request = createRequest("write"); request.addFileParameter("file", in); return request.getString(); } catch (IOException e) { throw toMicroKernelException(e); } finally { IOUtils.closeQuietly(request); IOUtils.closeQuietly(in); } }
@Override public String getHeadRevision() throws MicroKernelException { Request request = null; try { request = createRequest("getHeadRevision"); return request.getString(); } catch (IOException e) { throw new MicroKernelException(e); } finally { IOUtils.closeQuietly(request); } }
@Override public long getLength(String blobId) throws MicroKernelException { Request request = null; try { request = createRequest("getLength"); request.addParameter("blob_id", blobId); return request.getLong(); } catch (IOException e) { throw toMicroKernelException(e); } finally { IOUtils.closeQuietly(request); } }
@Override public String branch(String trunkRevisionId) throws MicroKernelException { Request request = null; try { request = createRequest("branch"); request.addParameter("trunk_revision_id", trunkRevisionId); return request.getString(); } catch (IOException e) { throw toMicroKernelException(e); } finally { IOUtils.closeQuietly(request); } }
@Test public void sortCustomComparatorTest() throws IOException { List<String> list = getLineBreakStrings(); File f = assertWrite(list.iterator(), true, list.size()); sort(f, lineBreakAwareComparator(lexComparator)); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f), UTF_8)); String line; List<String> retrieved = newArrayList(); while ((line = reader.readLine()) != null) { retrieved.add(unescapeLineBreaks(line)); } closeQuietly(reader); Collections.sort(list); assertArrayEquals(Arrays.toString(list.toArray()), list.toArray(), retrieved.toArray()); }
@Override public long getChildNodeCount(String path, String revisionId) throws MicroKernelException { Request request = null; try { request = createRequest("getChildNodeCount"); request.addParameter("path", path); request.addParameter("revision_id", revisionId); return request.getLong(); } catch (IOException e) { throw toMicroKernelException(e); } finally { IOUtils.closeQuietly(request); } }
@Override public String merge(String branchRevisionId, String message) throws MicroKernelException { Request request = null; try { request = createRequest("merge"); request.addParameter("branch_revision_id", branchRevisionId); request.addParameter("message", message); return request.getString(); } catch (IOException e) { throw toMicroKernelException(e); } finally { IOUtils.closeQuietly(request); } }
@Override public String waitForCommit(String oldHeadRevisionId, long maxWaitMillis) throws MicroKernelException, InterruptedException { Request request = null; try { request = createRequest("waitForCommit"); request.addParameter("revision_id", oldHeadRevisionId); request.addParameter("max_wait_millis", maxWaitMillis); return request.getString(); } catch (IOException e) { throw toMicroKernelException(e); } finally { IOUtils.closeQuietly(request); } }
@Override public boolean nodeExists(String path, String revisionId) throws MicroKernelException { Request request = null; try { request = createRequest("nodeExists"); request.addParameter("path", path); request.addParameter("revision_id", revisionId); return request.getBoolean(); } catch (IOException e) { throw toMicroKernelException(e); } finally { IOUtils.closeQuietly(request); } }
@After public void clean() throws IOException { try { if (session != null) { session.logout(); } if (repository != null) { repository.shutdown(); } } finally { IOUtils.closeQuietly(getDestinationContainer()); getDestinationContainer().clean(); getSourceContainer().clean(); } }