本文整理了Java中org.apache.jackrabbit.oak.commons.IOUtils.closeQuietly()
方法的一些代码示例,展示了IOUtils.closeQuietly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.closeQuietly()
方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.commons.IOUtils
类名称:IOUtils
方法名:closeQuietly
[英]Unconditionally close a Closeable.
Equivalent to Closeable#close(), except any exceptions will be ignored. This is typically used in finally blocks.
[中]无条件关闭一个可关闭的窗口。
与Closeable#close()等效,但任何异常都将被忽略。这通常用于finally块。
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
/**
* Close this executor.
*/
@Override
public void close() {
IOUtils.closeQuietly(socketOut);
IOUtils.closeQuietly(socketIn);
IOUtils.closeQuietly(socket);
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk
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;
}
代码示例来源:origin: apache/jackrabbit-oak
@Deactivate
public void deactivate() {
closeQuietly(closer);
}
代码示例来源:origin: apache/jackrabbit-oak
@Deactivate
public void deactivate() {
closeQuietly(registrations);
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
@Override
public void removedService(ServiceReference reference, Object service) {
Closeable subscription = subscriptions.remove(reference);
if (subscription != null) {
closeQuietly(subscription);
bundleContext.ungetService(reference);
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public void removedService(ServiceReference reference, Object service) {
Closeable subscription = subscriptions.remove(reference);
if (subscription != null) {
closeQuietly(subscription);
bundleContext.ungetService(reference);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk
public void close() {
verifyInitialized();
if (gcExecutor != null) {
gcExecutor.shutdown();
}
cache.invalidateAll();
IOUtils.closeQuietly(pm);
initialized = false;
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@Override
public void close() throws IOException {
committed = true;
try {
sendHeaders();
IOUtils.closeQuietly(respOut);
if (out != null) {
out.flush();
}
} finally {
out = null;
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@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;
}
}
}
}
代码示例来源:origin: apache/jackrabbit-oak
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);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@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);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@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);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@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);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@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);
}
}
代码示例来源:origin: apache/jackrabbit-oak
@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());
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@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);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@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);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@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);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-mk-remote
@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);
}
}
代码示例来源:origin: apache/jackrabbit-oak
@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();
}
}
内容来源于网络,如有侵权,请联系作者删除!