Example #1
0
File: Pty.java Project: jawi/JPty
 static <T extends Closeable> T closeSilently(T resource) {
   try {
     if (resource != null) {
       resource.close();
     }
   } catch (Exception e) {
     // Ignore...
   }
   return null;
 }
Example #2
0
 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();
 }
Example #6
0
 @Override
 public void close() {
   handler.close();
 }