static <T extends Closeable> T closeSilently(T resource) { try { if (resource != null) { resource.close(); } } catch (Exception e) { // Ignore... } return null; }
public static <T extends Closeable> void test(T... a) { for (T temp : a) { try { if (null != temp) { temp.close(); } } catch (IOException e) { e.printStackTrace(); } } }
/* (non-Javadoc) * @see * com.blockwithme.longdb.BEDatabase#drop(com.blockwithme.longdb.entities * .Base36) */ @Override public final boolean drop(final Base36 theTable) { open(); final T dropped = tables.get(theTable); if (dropped != null) { dropInternal(dropped); if (dropped.opened) { dropped.close(); // $codepro.audit.disable closeInFinally } tables.remove(theTable); return true; } return false; }
/* (non-Javadoc) * @see com.blockwithme.longdb.BEDatabase#close() */ @Override public final void close() { if (!closed) { closed = true; if (open) { open = false; for (final T table : tables.values()) { final String name = table.toString(); try { table.close(); // $codepro.audit.disable closeInFinally } catch (final Throwable t) { LOG.error("Error closing: " + name, t); } } closeInternal(); } } }
@Override public void close() throws IOException { channel.close(); }
@Override public void close() { handler.close(); }