DomainSocketWatcher implements Closeable { @Override public void close() throws IOException { lock.lock(); try { if (closed) return; if (LOG.isDebugEnabled()) { LOG.debug(this + ": closing"); } closed = true; } finally { lock.unlock(); } notificationSockets[0].close(); Uninterruptibles.joinUninterruptibly(watcherThread); } DomainSocketWatcher(int interruptCheckPeriodMs); static String getLoadingFailureReason(); @Override void close(); @VisibleForTesting boolean isClosed(); void add(DomainSocket sock, Handler handler); void remove(DomainSocket sock); String toString();  }
@Test(timeout=60000) public void testCreateShutdown() throws Exception { DomainSocketWatcher watcher = newDomainSocketWatcher(10000000); watcher.close(); }
@Test(timeout=60000) public void testInterruption() throws Exception { final DomainSocketWatcher watcher = newDomainSocketWatcher(10); watcher.watcherThread.interrupt(); Uninterruptibles.joinUninterruptibly(watcher.watcherThread); watcher.close(); }
@Test(timeout=60000) public void testCreateShutdown() throws Exception { DomainSocketWatcher watcher = new DomainSocketWatcher(10000000); watcher.close(); }
@Test(timeout=60000) public void testInterruption() throws Exception { final DomainSocketWatcher watcher = new DomainSocketWatcher(10); watcher.watcherThread.interrupt(); Uninterruptibles.joinUninterruptibly(watcher.watcherThread); watcher.close(); }