com.mongodb
Class DBPortPool

java.lang.Object
  extended by com.mongodb.util.SimplePool<DBPort>
      extended by com.mongodb.DBPortPool

public class DBPortPool
extends SimplePool<DBPort>

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()
           
 int getPort()
           
 ServerAddress getServerAddress()
           
 ConnectionPoolStatisticsBean getStatistics()
           
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
 

Method Detail

getHost

public String getHost()

getPort

public int getPort()

getStatistics

public ConnectionPoolStatisticsBean getStatistics()

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()