public class

DBPort

extends Object
java.lang.Object
   ↳ com.mongodb.DBPort

Class Overview

represents a Port to the database, which is effectively a single connection to a server Methods implemented at the port level should throw the raw exceptions like IOException, so that the connector above can make appropriate decisions on how to handle.

Summary

Constants
int PORT the default port
Public Constructors
DBPort(ServerAddress addr)
creates a new DBPort
Public Methods
synchronized void ensureOpen()
makes sure that a connection to the server has been opened
DBPortPool getPool()
Gets the pool that this port belongs to
int hashCode()
String host()
returns a String representation of the target host
ServerAddress serverAddress()
String toString()
Protected Methods
void close()
closes the underlying connection and streams
void finalize()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int PORT

the default port

Constant Value: 27017 (0x00006989)

Public Constructors

public DBPort (ServerAddress addr)

creates a new DBPort

Parameters
addr the server address

Public Methods

public synchronized void ensureOpen ()

makes sure that a connection to the server has been opened

Throws
IOException

public DBPortPool getPool ()

Gets the pool that this port belongs to

public int hashCode ()

public String host ()

returns a String representation of the target host

public ServerAddress serverAddress ()

Returns
  • the server address for this port

public String toString ()

Protected Methods

protected void close ()

closes the underlying connection and streams

protected void finalize ()

Throws
Throwable