| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| 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.PoolTaskThe task for connection timeout. | 
| Field Summary | |
|---|---|
| protected  Set<XAConnectionImpl> | activeConnectionSetThe set for active connection. | 
| protected  Map<Transaction,XAConnectionImpl> | activeTxConnectionMapThe map for active transactional connection. | 
| static int | DEFAULT_TRANSACTION_ISOLATION_LEVELThe default transaction isolation level. | 
| protected  String | driverClassNameThe driver class name. | 
| protected  LinkedList<DataSourceImpl.PoolTask> | freePoolThe pool for free connection. | 
| protected  long | freePoolTimeoutThe free pool timeout(milliseconds). | 
| protected static Log | logThe log. | 
| protected  int | loginTimeoutThe login timeout. | 
| protected  int | maxActiveSizeThe max number of active connections. | 
| protected  String | passwordThe password. | 
| protected  boolean | readOnlyWhether connection is read only. | 
| protected static Timer | timerThe timer. | 
| protected  int | transactionIsolationLevelThe transaction isolation level. | 
| protected  TransactionManager | transactionManagerThe transaction manager. | 
| protected  String | urlJDBC driver url. | 
| protected  String | userThe user. | 
| protected  String | validationQueryThe 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 level
public Connection getConnection()
                         throws SQLException
getConnection in interface DataSourceSQLException
public Connection getConnection(String user,
                                String password)
                         throws SQLException
getConnection in interface DataSourceSQLException
protected XAConnection getXAConnection()
                                throws SQLException
SQLException - if a SQL exception is encountered
protected 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 null
public PrintWriter getLogWriter()
                         throws SQLException
getLogWriter in interface DataSourceSQLException
public void setLogWriter(PrintWriter logWriter)
                  throws SQLException
setLogWriter in interface DataSourceSQLException
public int getLoginTimeout()
                    throws SQLException
getLoginTimeout in interface DataSourceSQLException
public void setLoginTimeout(int loginTimeout)
                     throws SQLException
setLoginTimeout in interface DataSourceSQLExceptionpublic void connectionClosed(ConnectionEvent event)
connectionClosed in interface ConnectionEventListenerpublic void connectionErrorOccurred(ConnectionEvent event)
connectionErrorOccurred in interface ConnectionEventListenerpublic void close()
protected Transaction getTransaction()
protected void finalize()
                 throws Throwable
finalize in class ObjectThrowableprotected void addFreePool(XAConnectionImpl pooledConnection)
pooledConnection - the connectionprotected boolean validateConnection(Connection con)
con - the connection
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||