Class MongoServer

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

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

    Constructors 
    Constructor Description
    MongoServer​(MongoBackend backend)  
  • Method Summary

    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 bind​(java.net.SocketAddress socketAddress, int numberOfBossThreads, int numberOfWorkerThreads)  
    void closeCursors​(MongoKillCursors killCursors)
    Use this method to simulate closing of cursors by the server, for instance due to timeout.
    void enableOplog()  
    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 stopListening()
    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 Details

  • Method Details

    • enableOplog

      public void enableOplog()
    • 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 void bind​(java.net.SocketAddress socketAddress, int numberOfBossThreads, int numberOfWorkerThreads)
    • 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.
    • 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 java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • closeCursors

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