com.mongodb
Class DBPort

java.lang.Object
  extended by com.mongodb.DBPort

public class DBPort
extends Object

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.


Field Summary
static int PORT
          the default port
 
Constructor Summary
DBPort(ServerAddress addr)
          creates a new DBPort
 
Method Summary
protected  void close()
          closes the underlying connection and streams
 void ensureOpen()
          makes sure that a connection to the server has been opened
protected  void finalize()
           
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PORT

public static final int PORT
the default port

See Also:
Constant Field Values
Constructor Detail

DBPort

public DBPort(ServerAddress addr)
creates a new DBPort

Parameters:
addr - the server address
Method Detail

ensureOpen

public void ensureOpen()
                throws IOException
makes sure that a connection to the server has been opened

Throws:
IOException

hashCode

public int hashCode()
Overrides:
hashCode in class Object

host

public String host()
returns a String representation of the target host

Returns:

serverAddress

public ServerAddress serverAddress()
Returns:
the server address for this port

toString

public String toString()
Overrides:
toString in class Object

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

close

protected void close()
closes the underlying connection and streams


getPool

public DBPortPool getPool()
Gets the pool that this port belongs to

Returns: