com.mongodb
Class DBPortPool

java.lang.Object
  extended by com.mongodb.util.SimplePool<DBPort>
      extended by com.mongodb.DBPortPool
All Implemented Interfaces:
MongoConnectionPoolMXBean

public class DBPortPool
extends SimplePool<DBPort>
implements MongoConnectionPoolMXBean

This class is NOT part of the public API. Be prepared for non-binary compatible changes in minor releases.


Nested Class Summary
static class DBPortPool.ConnectionWaitTimeOut
           
static class DBPortPool.NoMoreConnection
           
static class DBPortPool.SemaphoresOut
           
 
Field Summary
 
Fields inherited from class com.mongodb.util.SimplePool
_avail, _name, _out, _size
 
Method Summary
 void cleanup(DBPort p)
          override this if you need to do any cleanup
protected  DBPort createNew()
          Creates a new object of this pool's type.
 DBPort get()
          Gets an object from the pool - will block if none are available
 String getHost()
          Gets the host that this connection pool is connecting to.
 int getPort()
          Gets the port that this connection pool is connecting to.
 ServerAddress getServerAddress()
           
 ConnectionPoolStatisticsBean getStatistics()
          Gets the statistics for this connection pool.
protected  long memSize(DBPort p)
           
protected  int pick(int recommended, boolean couldCreate)
          Pick a member of _avail.
 
Methods inherited from class com.mongodb.util.SimplePool
close, done, get, getAvailable, getInUse, getMaxSize, getName, getTotal, remove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.mongodb.MongoConnectionPoolMXBean
getMaxSize, getName
 

Method Detail

getHost

public String getHost()
Description copied from interface: MongoConnectionPoolMXBean
Gets the host that this connection pool is connecting to.

Specified by:
getHost in interface MongoConnectionPoolMXBean
Returns:
the host

getPort

public int getPort()
Description copied from interface: MongoConnectionPoolMXBean
Gets the port that this connection pool is connecting to.

Specified by:
getPort in interface MongoConnectionPoolMXBean
Returns:
the port

getStatistics

public ConnectionPoolStatisticsBean getStatistics()
Description copied from interface: MongoConnectionPoolMXBean
Gets the statistics for this connection pool.

Specified by:
getStatistics in interface MongoConnectionPoolMXBean
Returns:
the connection pool statistics

memSize

protected long memSize(DBPort p)

pick

protected int pick(int recommended,
                   boolean couldCreate)
Description copied from class: SimplePool
Pick a member of _avail. This method is called with a lock held on _avail, so it may be used safely.

Overrides:
pick in class SimplePool<DBPort>
Parameters:
recommended - the recommended member to choose.
couldCreate - true if there is room in the pool to create a new object
Returns:
>= 0 the one to use, -1 create a new one

get

public DBPort get()
Description copied from class: SimplePool
Gets an object from the pool - will block if none are available

Overrides:
get in class SimplePool<DBPort>
Returns:
Throws:
MongoException

cleanup

public void cleanup(DBPort p)
Description copied from class: SimplePool
override this if you need to do any cleanup

Overrides:
cleanup in class SimplePool<DBPort>

createNew

protected DBPort createNew()
Description copied from class: SimplePool
Creates a new object of this pool's type. Implementations should throw a runtime exception if unable to create.

Specified by:
createNew in class SimplePool<DBPort>
Returns:
the new object.

getServerAddress

public ServerAddress getServerAddress()