Class DomainSocketWatcher

java.lang.Object
org.apache.hadoop.net.unix.DomainSocketWatcher
All Implemented Interfaces:
Closeable, AutoCloseable

@LimitedPrivate("HDFS") public final class DomainSocketWatcher extends Object implements Closeable
The DomainSocketWatcher watches a set of domain sockets to see when they become readable, or closed. When one of those events happens, it makes a callback. See DomainSocket for more information about UNIX domain sockets.
  • Constructor Details

  • Method Details

    • getLoadingFailureReason

      public static String getLoadingFailureReason()
    • close

      public void close() throws IOException
      Close the DomainSocketWatcher and wait for its thread to terminate. If there is more than one close, all but the first will be ignored.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • isClosed

      @VisibleForTesting public boolean isClosed()
    • add

      public void add(DomainSocket sock, DomainSocketWatcher.Handler handler)
      Add a socket.
      Parameters:
      sock - The socket to add. It is an error to re-add a socket that we are already watching.
      handler - The handler to associate with this socket. This may be called any time after this function is called.
    • remove

      public void remove(DomainSocket sock)
      Remove a socket. Its handler will be called.
      Parameters:
      sock - The socket to remove.
    • toString

      public String toString()
      Overrides:
      toString in class Object