Class ConcurrentServerRunner.ClientWrapper

  • All Implemented Interfaces:
    Client, java.io.Closeable, java.lang.AutoCloseable, java.lang.Runnable
    Enclosing class:
    ConcurrentServerRunner<T extends Client>

    private class ConcurrentServerRunner.ClientWrapper
    extends java.lang.Object
    implements Client
    A wrapper for a Client responsible for ensuring that client tracking is performed properly.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private T delegate  
    • Constructor Summary

      Constructors 
      Constructor Description
      ClientWrapper​(T client)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes any resources that are held by the client.
      void run()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • delegate

        private final T extends Client delegate
    • Constructor Detail

      • ClientWrapper

        public ClientWrapper​(T client)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • close

        public void close()
        Description copied from interface: Client
        Closes any resources that are held by the client.

        Note that (as described in Doug Lea's discussion about interrupting I/O operations in "Concurrent Programming in Java" (Addison-Wesley Professional, 2nd edition, 1999) this method is used to interrupt any blocked I/O operation in the client when the server is shutting down. The client implementation must anticipate this potential, and gracefully exit when the blocked I/O operation throws the relevant IOException subclass.

        Note also, that unlike Closeable.close() this method is not permitted to propagate any IOException that occurs when closing the underlying resource(s).

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface Client
        Specified by:
        close in interface java.io.Closeable