|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.slim3.datasource.DataSourceImpl
public class DataSourceImpl
An implementation class for XADataSource
.
Nested Class Summary | |
---|---|
protected class |
DataSourceImpl.PoolTask
The task for connection timeout. |
Field Summary | |
---|---|
protected Set<XAConnectionImpl> |
activeConnectionSet
The set for active connection. |
protected Map<Transaction,XAConnectionImpl> |
activeTxConnectionMap
The map for active transactional connection. |
static int |
DEFAULT_TRANSACTION_ISOLATION_LEVEL
The default transaction isolation level. |
protected String |
driverClassName
The driver class name. |
protected LinkedList<DataSourceImpl.PoolTask> |
freePool
The pool for free connection. |
protected long |
freePoolTimeout
The free pool timeout(milliseconds). |
protected static Log |
log
The log. |
protected int |
loginTimeout
The login timeout. |
protected int |
maxActiveSize
The max number of active connections. |
protected String |
password
The password. |
protected boolean |
readOnly
Whether connection is read only. |
protected static Timer |
timer
The timer. |
protected int |
transactionIsolationLevel
The transaction isolation level. |
protected TransactionManager |
transactionManager
The transaction manager. |
protected String |
url
JDBC driver url. |
protected String |
user
The user. |
protected String |
validationQuery
The query for connection validation. |
Constructor Summary | |
---|---|
DataSourceImpl()
Constructor. |
Method Summary | |
---|---|
protected void |
addFreePool(XAConnectionImpl pooledConnection)
Adds the connection to free pool. |
void |
close()
Closes pooled connections. |
void |
connectionClosed(ConnectionEvent event)
|
void |
connectionErrorOccurred(ConnectionEvent event)
|
protected void |
finalize()
|
Connection |
getConnection()
|
Connection |
getConnection(String user,
String password)
|
int |
getLoginTimeout()
|
PrintWriter |
getLogWriter()
|
protected Connection |
getPhysicalConnection(String user,
String password)
Returns a physical connection |
protected Transaction |
getTransaction()
Returns the transaction. |
protected XAConnection |
getXAConnection()
Returns the pooled connection. |
void |
setDriverClassName(String driverClassName)
Sets the driver class name. |
void |
setFreePoolTimeout(long freePoolTimeout)
Sets the free pool timeout(milliseconds) |
void |
setLoginTimeout(int loginTimeout)
|
void |
setLogWriter(PrintWriter logWriter)
|
void |
setMaxActiveSize(int maxActiveSize)
Sets the max number of active connections. |
void |
setPassword(String password)
Sets the password. |
void |
setReadOnly(boolean readOnly)
Sets the read only flag. |
void |
setTransactionIsolationLevel(int transactionIsolationLevel)
Sets transaction isolation level. |
void |
setTransactionManager(TransactionManager transactionManager)
Sets the transaction manager. |
void |
setUrl(String url)
Sets the JDBC driver url. |
void |
setUser(String user)
Sets the user. |
void |
setValidationQuery(String validationQuery)
Sets the query for connection validation. |
protected boolean |
validateConnection(Connection con)
Validates the connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_TRANSACTION_ISOLATION_LEVEL
protected static Log log
protected static Timer timer
protected TransactionManager transactionManager
protected long freePoolTimeout
protected int maxActiveSize
protected String validationQuery
protected Map<Transaction,XAConnectionImpl> activeTxConnectionMap
protected Set<XAConnectionImpl> activeConnectionSet
protected LinkedList<DataSourceImpl.PoolTask> freePool
protected String driverClassName
protected String url
protected String user
protected String password
protected int loginTimeout
protected boolean readOnly
protected int transactionIsolationLevel
Constructor Detail |
---|
public DataSourceImpl()
Method Detail |
---|
public void setDriverClassName(String driverClassName)
driverClassName
- the driver class namepublic void setUrl(String url)
url
- the JDBC driver urlpublic void setUser(String user)
user
- the userpublic void setPassword(String password)
password
- the passwordpublic void setTransactionManager(TransactionManager transactionManager)
transactionManager
- the transaction manager to setpublic void setFreePoolTimeout(long freePoolTimeout)
freePoolTimeout
- the free pool timeoutpublic void setMaxActiveSize(int maxActiveSize)
maxActiveSize
- the max number of active connectionspublic void setValidationQuery(String validationQuery)
validationQuery
- the query for connection validationpublic void setReadOnly(boolean readOnly)
readOnly
- the read only flagpublic void setTransactionIsolationLevel(int transactionIsolationLevel)
transactionIsolationLevel
- the transaction isolation levelpublic Connection getConnection() throws SQLException
getConnection
in interface DataSource
SQLException
public Connection getConnection(String user, String password) throws SQLException
getConnection
in interface DataSource
SQLException
protected XAConnection getXAConnection() throws SQLException
SQLException
- if a SQL exception is encounteredprotected Connection getPhysicalConnection(String user, String password) throws SQLException, NullPointerException
user
- the userpassword
- the password
SQLException
- if SQLException is encountered
NullPointerException
- if the driverClassName property is nullpublic PrintWriter getLogWriter() throws SQLException
getLogWriter
in interface DataSource
SQLException
public void setLogWriter(PrintWriter logWriter) throws SQLException
setLogWriter
in interface DataSource
SQLException
public int getLoginTimeout() throws SQLException
getLoginTimeout
in interface DataSource
SQLException
public void setLoginTimeout(int loginTimeout) throws SQLException
setLoginTimeout
in interface DataSource
SQLException
public void connectionClosed(ConnectionEvent event)
connectionClosed
in interface ConnectionEventListener
public void connectionErrorOccurred(ConnectionEvent event)
connectionErrorOccurred
in interface ConnectionEventListener
public void close()
protected Transaction getTransaction()
protected void finalize() throws Throwable
finalize
in class Object
Throwable
protected void addFreePool(XAConnectionImpl pooledConnection)
pooledConnection
- the connectionprotected boolean validateConnection(Connection con)
con
- the connection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |