Module id.ICE
Package id.ICE

Class MessageServer

  • All Implemented Interfaces:
    AutoCloseable, Runnable

    public class MessageServer
    extends Object
    implements Runnable, AutoCloseable
    Runs ICE server on a given port and manages all interaction between clients and MessageService.
    • Constructor Detail

      • MessageServer

        public MessageServer​(MessageService service,
                             MessageScanner scanner)
        service - message service implementation which will process all incoming messages
        scanner - scanner for messages to use
    • Method Detail

      • withNumberOfThreads

        public MessageServer withNumberOfThreads​(int threads)
      • run

        public void run()
        Starts ICE server. It opens a given port and starts to accept connections. For each new incoming connection it will run a looper.
        Specified by:
        run in interface Runnable
      • close

        public void close()
                   throws Exception
        Calling close on server which is not started has no effect
        Specified by:
        close in interface AutoCloseable