Class MongoServer


  • public class MongoServer
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.net.InetSocketAddress bind()
      starts and binds the server on a local random port
      void bind​(java.lang.String hostname, int port)  
      void bind​(java.net.SocketAddress socketAddress)  
      void enableSsl​(java.security.PrivateKey key, java.lang.String keyPassword, java.security.cert.X509Certificate... keyCertChain)  
      java.net.InetSocketAddress getLocalAddress()  
      void shutdown()
      Stop accepting new clients.
      void shutdownNow()
      Stops accepting new clients, closes all clients and finally shuts down the server In contrast to shutdown(), this method should not block.
      void stopListenting()
      Closes the server socket.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • enableSsl

        public void enableSsl​(java.security.PrivateKey key,
                              java.lang.String keyPassword,
                              java.security.cert.X509Certificate... keyCertChain)
      • bind

        public void bind​(java.lang.String hostname,
                         int port)
      • bind

        public void bind​(java.net.SocketAddress socketAddress)
      • bind

        public java.net.InetSocketAddress bind()
        starts and binds the server on a local random port
        Returns:
        the random local address the server was bound to
      • getLocalAddress

        public java.net.InetSocketAddress getLocalAddress()
        Returns:
        the local address the server was bound or null if the server is not listening
      • shutdown

        public void shutdown()
        Stop accepting new clients. Wait until all resources (such as client connection) are closed and then shutdown. This method blocks until all clients are finished. Use shutdownNow() if the shutdown should be forced.
      • stopListenting

        public void stopListenting()
        Closes the server socket. No new clients are accepted afterwards.
      • shutdownNow

        public void shutdownNow()
        Stops accepting new clients, closes all clients and finally shuts down the server In contrast to shutdown(), this method should not block.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object