|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.infoengine.jdbc.ResourcePool
ResourcePool class is the super class of your sesssion pooling or connection pooling class that provides the basic functionalities for you to implement the connection pooling. You may need to modify this file or rewrite the code to fit your implementation requirement.
Field Summary | |
protected Hashtable |
available
|
protected int |
currentCount
|
private boolean |
dp
|
private int |
errCode
|
(package private) static int |
ERROR_CREATE_CONNECTION
|
(package private) static int |
ERROR_INITIALIZE_POOL
|
(package private) static int |
ERROR_NO_AVAILABLE_CONNECTION
|
(package private) static int |
ERROR_NO_DRIVER_INSTALLED
|
protected int |
initCount
|
private String |
jdbcDriver
|
protected com.infoengine.log.LogWriter |
logWriter
|
protected int |
maximumCount
|
protected String |
serviceName
|
protected Hashtable |
unavailable
|
protected String |
url
|
Constructor Summary | |
ResourcePool()
Default constructor. |
|
ResourcePool(String svcName,
String urlink,
String users,
String passwds,
int initCount,
int maxCount)
Constructor for the pooling. |
Method Summary | |
protected Connection |
addConnection(String user,
String paswd)
This method create a connection with credential pair user/paswd and then add it to the connection/session pool. |
void |
closeConnection(Connection connection)
|
Connection |
createConnection(String url,
String user,
String paswd)
|
Hashtable |
getAvailableData()
|
int |
getAvailableSize()
|
Connection |
getConnection(String user,
String paswd)
This method gets a connection from the available pool if there is one, or checks for the idle connection from the other user to find one available before creating a new connection. |
int |
getErrorCode()
|
int |
getMaxCount()
|
String |
getServiceName()
|
Hashtable |
getUnavailableData()
|
int |
getUnavailableSize()
|
private void |
initPool(String users,
String passwds)
This method initialize the connection/session pooling. |
void |
putConnection(String user,
String paswd,
Connection conn)
This method add a connection to the connection/session pool. |
void |
removeConnection(Connection conn)
This method remove a connection from the unavailable pool. |
void |
removeConnection(String user,
String pwd,
Connection conn)
This method remove a connection from the unavailable pool. |
void |
returnConnection(Connection conn)
This method return a connection from the unavailable pool to the available pool. |
void |
returnConnection(String user,
String pwd,
Connection conn)
This method return a connection from the unavailable pool to the available pool. |
protected void |
setAvailable(Hashtable a)
|
protected void |
setCurrentCount(int c)
|
protected void |
setErrorCode(int e)
|
protected void |
setInitCount(int initCount)
|
protected void |
setLogWriter(com.infoengine.log.LogWriter log)
|
protected void |
setMaxCount(int maxCount)
|
protected void |
setServiceName(String svcName)
|
protected void |
setUnavailable(Hashtable ua)
|
private String |
userKey(String user,
String passwd)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int maximumCount
protected int currentCount
protected int initCount
protected Hashtable available
protected Hashtable unavailable
protected String serviceName
protected com.infoengine.log.LogWriter logWriter
protected String url
private String jdbcDriver
private boolean dp
private int errCode
static final int ERROR_CREATE_CONNECTION
static final int ERROR_NO_AVAILABLE_CONNECTION
static final int ERROR_INITIALIZE_POOL
static final int ERROR_NO_DRIVER_INSTALLED
Constructor Detail |
public ResourcePool()
public ResourcePool(String svcName, String urlink, String users, String passwds, int initCount, int maxCount) throws IEException
svcName
- The service name passed from the I*E server as the adapter instance.urlink
- The url that is used to connect to the back end application.users
- The user id(s), if more than one, they are separated by '+'.passwds
- The corresponding password(s), in the same order defined by the user(s)
that are separated by '+'.maxCount
- The maximum number of connections allowed for the pool.Method Detail |
public Connection createConnection(String url, String user, String paswd) throws IEException
createConnection
in interface PoolProcessor
IEException
public void closeConnection(Connection connection) throws IEException
closeConnection
in interface PoolProcessor
IEException
private void initPool(String users, String passwds) throws IEException
users
- The user id(s), if more than one, they are separated by '+'.passwds
- The corresponding password(s), if more than one, separated by '+'.
IEException
protected Connection addConnection(String user, String paswd) throws IEException
user
- A single uesr id.paswd
- The corresponding password.
IEException
public void putConnection(String user, String paswd, Connection conn)
user
- The single user id.paswd
- The corresponding password.conn
- The connection object to be added with the above credentials.public Connection getConnection(String user, String paswd) throws IEException
user
- The single user id.paswd
- The corresponding password.
IEException
public void returnConnection(String user, String pwd, Connection conn) throws IEException
user
- The single user id.pwd
- The corresponding password.conn
- The connection associated with the above credentials to be returned
to the available pool for reuse.
IEException
public void returnConnection(Connection conn) throws IEException
conn
- The connection to be returned to the available pool for
reuse.
IEException
public void removeConnection(String user, String pwd, Connection conn) throws IEException
user
- The single user id.pwd
- The corresponding password.conn
- The connection associated with the above credentials to be
returned
to the available pool for reuse.
IEException
public void removeConnection(Connection conn) throws IEException
conn
- The connection to be returned to the available pool for reuse.
IEException
public int getMaxCount()
public String getServiceName()
public int getUnavailableSize()
public int getAvailableSize()
public Hashtable getAvailableData()
public Hashtable getUnavailableData()
public int getErrorCode()
private String userKey(String user, String passwd)
protected void setMaxCount(int maxCount)
protected void setInitCount(int initCount)
protected void setServiceName(String svcName)
protected void setLogWriter(com.infoengine.log.LogWriter log)
protected void setUnavailable(Hashtable ua)
protected void setAvailable(Hashtable a)
protected void setCurrentCount(int c)
protected void setErrorCode(int e)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |