Class MongoServer

java.lang.Object
de.bwaldvogel.mongo.MongoServer

public class MongoServer extends Object
  • Constructor Details

  • Method Details

    • enableOplog

      public void enableOplog()
    • enableSsl

      public void enableSsl(PrivateKey key, String keyPassword, X509Certificate... keyCertChain)
    • bind

      public void bind(String hostname, int port)
    • bind

      public void bind(SocketAddress socketAddress)
    • bind

      public void bind(SocketAddress socketAddress, int numberOfBossThreads, int numberOfWorkerThreads)
    • bind

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

      public 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.
    • stopListening

      public void stopListening()
      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 String toString()
      Overrides:
      toString in class Object
    • closeCursors

      public void closeCursors(MongoKillCursors killCursors)
      Use this method to simulate closing of cursors by the server, for instance due to timeout.