org.xsocket.stream
Interface IConnectionPool

Package class diagram package IConnectionPool
All Known Implementing Classes:
BlockingConnectionPool, NonBlockingConnectionPool

public interface IConnectionPool

a connection pool


Method Summary
 void close()
          closes the connection pool.
 void destroyConnection(IConnection connection)
          destroy the given connection.
 long getIdleTimeoutMillis()
          get the idle timeout for pooled connections
 long getLifeTimeoutMillis()
          get the life timeout
 int getMaxActive()
          return the number of max active connections
 int getMaxIdle()
          get the number of max idle connections
 long getMaxWaitMillis()
          get the max wait time to get a free connection by calling the getXXXConnection().
 int getNumActive()
          get the number of the active (borrowed) connects
 int getNumIdle()
          get the number of idling connections connections
 void setIdleTimeoutMillis(long idleTimeoutMillis)
          set the idle timeout for pooled connections
 void setLifeTimeoutMillis(long lifeTimeoutMillis)
          set the life timeout
 void setMaxActive(int maxActive)
          set the number of max active connections
 void setMaxIdle(int maxIdle)
          set the number of max idle connections
 void setMaxWaitMillis(long maxWaitMillis)
          set the max wait time to get a free connection by calling the getXXXConnection().
 

Method Detail

destroyConnection

void destroyConnection(IConnection connection)
                       throws java.io.IOException
destroy the given connection. This connection will not return into the pool. It will be really closed instead. A leased connection should be destroyed by this way, if it is clear that the connection has become invalid.

Parameters:
connection - the leased connection
Throws:
java.io.IOException - if an exception occurs

getMaxActive

int getMaxActive()
return the number of max active connections

Returns:
the number of max active connections

setMaxActive

void setMaxActive(int maxActive)
set the number of max active connections

Parameters:
maxActive - the number of max active connections

getMaxWaitMillis

long getMaxWaitMillis()
get the max wait time to get a free connection by calling the getXXXConnection().

Returns:
the max wait time to get a free connection

setMaxWaitMillis

void setMaxWaitMillis(long maxWaitMillis)
set the max wait time to get a free connection by calling the getXXXConnection().

Parameters:
maxWaitMillis - the max wait time to get a free connection

getMaxIdle

int getMaxIdle()
get the number of max idle connections

Returns:
the number of max idle connections

setMaxIdle

void setMaxIdle(int maxIdle)
set the number of max idle connections

Parameters:
maxIdle - the number of max idle connections

getNumActive

int getNumActive()
get the number of the active (borrowed) connects

Returns:
the number of the active connects

getNumIdle

int getNumIdle()
get the number of idling connections connections

Returns:
the number of idling connections connections

getIdleTimeoutMillis

long getIdleTimeoutMillis()
get the idle timeout for pooled connections

Returns:
the idle timeout for pooled connections

setIdleTimeoutMillis

void setIdleTimeoutMillis(long idleTimeoutMillis)
set the idle timeout for pooled connections

Parameters:
idleTimeoutMillis - the idle timeout for pooled connections

getLifeTimeoutMillis

long getLifeTimeoutMillis()
get the life timeout

Returns:
the life timeout

setLifeTimeoutMillis

void setLifeTimeoutMillis(long lifeTimeoutMillis)
set the life timeout

Parameters:
lifeTimeoutMillis - the life timeout

close

void close()
closes the connection pool. All free connection of the pool will be closed