[cvs]
expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/db
DBConfig.java DBConnection.java DBConnectionPool.java
TableCreator.java
JCorporate Ltd
jcorp at jcorp2.servlets.net
Mon Sep 20 12:21:50 PDT 2004
Update of /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/db
In directory jcorp2.servlets.net:/tmp/cvs-serv906
Modified Files:
DBConfig.java DBConnection.java DBConnectionPool.java
TableCreator.java
Log Message:
<Aucun commentaire entré>
Index: DBConnection.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/db/DBConnection.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** DBConnection.java 18 Sep 2004 00:04:43 -0000 1.49
--- DBConnection.java 20 Sep 2004 19:21:48 -0000 1.50
***************
*** 75,79 ****
import java.io.PrintWriter;
- import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
--- 75,78 ----
***************
*** 100,104 ****
* pooling, and have special methods to support this.
*
- * @version $Revision$ $Date$
* @author Michael Nash
*/
--- 99,102 ----
***************
*** 148,156 ****
private PreparedStatement preparedStatement = null;
- /**
- * Any callable statements that might be run
- */
- private CallableStatement callableStatement = null;
-
/** Current result set */
private ResultSet myResultSet;
--- 146,149 ----
***************
*** 295,376 ****
private int limitationPosition = LIMITATION_DISABLED;
-
- /** Committed read transaction mode
- *
- * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
- * @since Expresso 5.3
- *
- */
- public static final int TRANSACTION_NORMAL_MODE = 1;
-
- /** Uncommitted read transaction mode
- *
- * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
- * @since Expresso 5.3
- *
- */
- public static final int TRANSACTION_DIRTY_MODE = 2;
-
- /** Repeatable read transaction mode
- *
- * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
- * @since Expresso 5.3
- *
- */
- public static final int TRANSACTION_RESTRICTIVE_MODE = 3;
-
- /** Serializable read transaction mode
- *
- * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
- * @since Expresso 5.3
- *
- */
- public static final int TRANSACTION_EXCLUSIVE_MODE = 4;
-
-
- /**
- * Transaction isolation mode set : Default Expresso transaction mode.
- *
- * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
- * @since Expresso 5.3
- *
- * @see Connection#TRANSACTION_READ_COMMITTED MODE
- *
- */
- private int transactionCommittedMode = TRANSACTION_NORMAL_MODE;
-
- /**
- * Transaction isolation mode set
- *
- * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
- * @since Expresso 5.3
- *
- * @see Connection#TRANSACTION_READ_UNCOMMITTED MODE
- *
- */
- private int transactionUncommittedMode = TRANSACTION_DIRTY_MODE;
-
- /**
- * Transaction isolation mode set
- *
- * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
- * @since Expresso 5.3
- *
- * @see Connection#TRANSACTION_REPEATABLE_READ MODE
- *
- */
- private int transactionRepeatableMode = TRANSACTION_RESTRICTIVE_MODE;
-
- /**
- * Transaction isolation mode set
- *
- * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
- * @since Expresso 5.3
- *
- * @see Connection#TRANSACTION_SERIALIZABLE MODE
- *
- */
- private int transactionSerializableMode = TRANSACTION_EXCLUSIVE_MODE;
-
/**
* Rowset Limitation Optimisation Syntax String.
--- 288,291 ----
***************
*** 844,891 ****
}
- /**
- * Creates a <code>CallableStatment</code> object.
- * @param sqlString The string to create the callable statement with.
- * @return an instantiated callable statement, that you then modify for
- * your various parameters May return null if an exception occurred
- */
- public CallableStatement createCallableStatement(String sqlString) {
- try {
- if (myConnection == null) {
- return null;
- }
- touch();
-
- if (callableStatement != null) {
- try {
- callableStatement.close();
- } catch (SQLException ex) {
- log.warn("Error closing older callable statement: ", ex);
- }
- }
- callableStatement = myConnection.prepareCall(sqlString);
- } catch (SQLException e) {
- log.error(e);
- }
- return callableStatement;
- }
-
-
- /**
- * Clear a callable statement associated with this record.
- */
- public void clearCallableStatement() {
- if (this.callableStatement != null) {
- try {
- callableStatement.close();
- } catch (SQLException ex) {
- log.warn("Error clearing callable statement", ex);
- }
-
- callableStatement = null;
- }
- }
-
-
/**
--- 759,762 ----
***************
*** 908,913 ****
try {
if (myConnection.getAutoCommit() == false) {
! // myConnection.commit();
! myConnection.rollback();
}
}
--- 779,783 ----
try {
if (myConnection.getAutoCommit() == false) {
! myConnection.commit();
}
}
***************
*** 931,935 ****
myConnection = null;
isConnected = false;
- immortal = false;
} /* disconnect() */
--- 801,804 ----
***************
*** 1155,1251 ****
- /**
- * Execute the actual store procedure in callableStatment
- * Store procedures method are expected to return a result
- * - use executeUpdate for queries that do not.
- * @throws DBException If the query fails or is an update query.
- */
- public synchronized void executeProcedure()
- throws DBException {
- long beginTimer = 0;
- touch();
-
- if (!isConnected) {
- throw new DBException("Not connected to database " +
- "- called connect method first (" +
- myDescription + ", db/context '" +
- getDataContext() + "')");
- }
-
- checkTimeOut();
-
- try {
- if (myConnection == null) {
- throw new DBException("No current connection - " +
- "connect to database failed: Unable to execute query:" +
- "callableStatment" + " (" + myDescription +
- ", db/context '" + getDataContext() + "')");
- }
-
- //
- //More robust recovery. Some databases will throw a sqlexception
- //if the resultset or statement is already closed
- //
- if (myResultSet != null) {
- try {
- myResultSet.close();
- }
- catch (SQLException ex) {
- log.warn("Error closing resultset", ex);
- }
- myResultSet = null;
- }
- if (log.isDebugEnabled()) {
- beginTimer = System.currentTimeMillis();
- }
-
- if (stmnt != null) {
- try {
- stmnt.close();
- }
- catch (SQLException ex) {
- log.warn("Error closing statement", ex);
- }
- stmnt = null;
- }
-
-
- //
- //If a callable statement has been created
- //then we assume we want a callable statement to execute.
- //
- if (callableStatement != null ) {
-
- if (sqlLog.isDebugEnabled()) {
- sqlLog.debug("Connection " + getId() + " Executing: callableStatement" +
- " on db '" + getDataContext() + "'");
- }
-
- // boolean hasResultSet = callableStatement.execute();
- myResultSet = callableStatement.executeQuery();
- // if (hasResultSet) {
- // lastUpdateCount = callableStatement.getUpdateCount();
- // myResultSet = callableStatement.getResultSet();
- // }
- } else {
- throw new DBException("Unable to execute statement: callableStatment" +
- " (" + myDescription + ", db/context '" +
- getDataContext() + "')");
- }
-
- if (log.isDebugEnabled()) {
- long endTimer = System.currentTimeMillis();
- log.debug("Time to execute callableStatment'" + "' was " +
- (endTimer - beginTimer) +
- " milliseconds");
- }
- } catch (SQLException se) {
- throw new DBException("Unable to execute statement: callableStatment" +
- " (" + myDescription + ", db/context '" +
- getDataContext() + "')", se);
- }
- } /* executeProcedure() */
-
-
/**
* Disconnect abandoned connections
--- 1024,1027 ----
***************
*** 1870,1952 ****
public String getString(int fieldNum)
throws DBException {
! checkTimeOut();
!
! if (myResultSet == null) {
! throw new DBException("[2]Null ResultSet object (" + myDescription + ")");
! }
! try {
! String resultValue = myResultSet.getString(fieldNum);
! if (resultValue == null) {
! return null;
! }
! return resultValue.trim();
! } catch (SQLException se) {
! if (strSQL == null) {
! strSQL = ("null");
! }
! throw new DBException("Error fetching string field " + fieldNum + ":Last SQL was:" + strSQL + " (" +
! myDescription + ")", se.getMessage());
! }
} /* getString(int) */
- /**
- * Return the numbered field as a string, not trimming any trailing spaces
- *
- * @param fieldNum The number of the desired field
- * @return String The string field value
- * @throws DBException If an error occurrs accessing the given field
- */
- public String getStringNoTrim(int fieldNum)
- throws DBException {
- checkTimeOut();
-
- if (myResultSet == null) {
- throw new DBException("Null ResultSet object (" + myDescription + ")");
- }
- try {
- String resultValue = myResultSet.getString(fieldNum);
-
- if (resultValue == null) {
- // return "";
- return null;
- }
-
- return resultValue;
- } catch (SQLException se) {
- throw new DBException("Error fetching string field " + fieldNum + ":Last SQL was:" + strSQL + " (" +
- " (" + myDescription + ")", se.getMessage());
- }
- } /* getStringNoTrim(int) */
-
-
- /**
- * Return the value in the named field as a string, trimming off
- * any trailing whitespace
- *
- * @param fieldName The desired column name
- * @return String The value of the field as a string, less any trailing
- * whitespace
- * @throws DBException If the value cannot be accessed
- */
- public String getString(String fieldName)
- throws DBException {
-
- String resultValue = getStringNoTrim(fieldName);
-
- if (resultValue == null) {
- return null;
- }
-
- return resultValue.trim();
- } /* getString(String) */
-
-
/**
! * Return the value in the named field as a string
*
* @param fieldName The desired column name
--- 1646,1678 ----
public String getString(int fieldNum)
throws DBException {
+ checkTimeOut();
! if (myResultSet == null) {
! throw new DBException("[2]Null ResultSet object (" +
! myDescription + ")");
! }
! try {
! String resultValue = myResultSet.getString(fieldNum);
! if (resultValue == null) {
! return null;
! }
! return resultValue.trim();
! } catch (SQLException se) {
! if (strSQL == null) {
! strSQL = ("null");
! }
! throw new DBException("Error fetching string field " + fieldNum +
! ":Last SQL was:" + strSQL + " (" +
! myDescription + ")", se.getMessage());
! }
} /* getString(int) */
/**
! * Return the value in the named field as a string, trimming off
! * any trailing whitespace
*
* @param fieldName The desired column name
***************
*** 1955,1964 ****
* @throws DBException If the value cannot be accessed
*/
! public String getStringNoTrim(String fieldName)
throws DBException {
checkTimeOut();
if (myResultSet == null) {
! throw new DBException("[2]Null ResultSet object (" + myDescription + ")");
}
try {
--- 1681,1691 ----
* @throws DBException If the value cannot be accessed
*/
! public String getString(String fieldName)
throws DBException {
checkTimeOut();
if (myResultSet == null) {
! throw new DBException("[2]Null ResultSet object (" +
! myDescription + ")");
}
try {
***************
*** 1969,1973 ****
}
! return resultValue;
} catch (SQLException se) {
if (strSQL == null) {
--- 1696,1700 ----
}
! return resultValue.trim();
} catch (SQLException se) {
if (strSQL == null) {
***************
*** 1975,1985 ****
}
! throw new DBException("Error fetching string field " + fieldName + ":Last SQL was:" + strSQL + " (" +
myDescription + ")", se.getMessage());
}
! } /* getStringNoTrim(String) */
/**
* Return the value in the named field as a string, trimming off
* any trailing whitespace
--- 1702,1742 ----
}
! throw new DBException("Error fetching string field " + fieldName +
! ":Last SQL was:" + strSQL + " (" +
myDescription + ")", se.getMessage());
}
! } /* getString(int) */
/**
+ * Return the numbered field as a string, not trimming any trailing spaces
+ *
+ * @param fieldNum The number of the desired field
+ * @return String The string field value
+ * @throws DBException If an error occurrs accessing the given field
+ */
+ public String getStringNoTrim(int fieldNum)
+ throws DBException {
+ checkTimeOut();
+
+ if (myResultSet == null) {
+ throw new DBException("Null ResultSet object (" + myDescription +
+ ")");
+ }
+ try {
+ String resultValue = myResultSet.getString(fieldNum);
+
+ if (resultValue == null) {
+ return "";
+ }
+
+ return resultValue;
+ } catch (SQLException se) {
+ throw new DBException("Error fetching string field " + fieldNum +
+ " (" + myDescription + ")", se.getMessage());
+ }
+ } /* getStringNoTrim(int) */
+
+ /**
* Return the value in the named field as a string, trimming off
* any trailing whitespace
***************
*** 2260,2296 ****
}
- /**
- * Return the Database current transaction mode set.
- *
- * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
- * @since Expresso 5.3
- *
- * @return Expresso corrresponding values.
- * @throws DBException
- */
- public int getTransactionMode()
- throws DBException {
- try {
- int transactionMode = myConnection.getTransactionIsolation();
- switch (transactionMode) {
- case Connection.TRANSACTION_NONE :
- return 0;
- case Connection.TRANSACTION_READ_COMMITTED :
- return transactionCommittedMode;
- case Connection.TRANSACTION_READ_UNCOMMITTED :
- return transactionUncommittedMode;
- case Connection.TRANSACTION_REPEATABLE_READ :
- return transactionRepeatableMode;
- case Connection.TRANSACTION_SERIALIZABLE :
- return transactionSerializableMode;
- }
- } catch (SQLException se) {
- throw new DBException("Unable to retrieve transaction mode set " +
- " for this connection", se);
- }
- return -1;
- }
-
-
/**
* When this connection is used as part of a pool of connections,
--- 2017,2020 ----
***************
*** 2583,2730 ****
}
!
! /**
! * Set Database transaction isolation mode.
! *
! * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
! * @since Expresso 5.3
! *
! * @throws DBException
! */
! public void setTransactionIsolation(int isolationMode)
! throws DBException {
! try {
! if (supportsTransactions()) {
! myConnection.setTransactionIsolation(isolationMode);
! }
! } catch (SQLException se) {
! throw new DBException("Unable to set Database transaction isolation mode set " +
! " for this connection", se);
! }
! }
!
! /**
! * Set EXPRESSO transaction mode for the current DBConnection.
! *
! * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
! * @since Expresso 5.3
! *
! * @throws DBException
! */
! public void setTransactionMode(int transactionMode) throws DBException {
!
! try {
! switch (transactionMode) {
! case TRANSACTION_NORMAL_MODE :
! setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
! case TRANSACTION_DIRTY_MODE :
! setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
! case TRANSACTION_RESTRICTIVE_MODE :
! setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
! case TRANSACTION_EXCLUSIVE_MODE :
! setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
! }
! } catch (DBException se) {
! throw new DBException("", se);
! }
! }
!
! /**
! * Set EXPRESSO transaction mode for the current DBConnection.
! *
! * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
! * @since Expresso 5.3
! *
! * @throws DBException
! */
! public void setTransactionCommittedMode() throws DBException {
!
! try {
! setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
! } catch (DBException se) {
! throw new DBException("", se);
! }
! }
!
! /**
! * Set EXPRESSO transaction mode for the current DBConnection.
! *
! * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
! * @since Expresso 5.3
! *
! * @throws DBException
! */
! public void setTransactionUncommittedMode() throws DBException {
!
! try {
! setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
! } catch (DBException se) {
! throw new DBException("", se);
! }
! }
!
! /**
! * Set EXPRESSO transaction mode for the current DBConnection.
! *
! * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
! * @since Expresso 5.3
! *
! * @throws DBException
! */
! public void setTransactionRepeatableMode() throws DBException {
!
! try {
! setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
! } catch (DBException se) {
! throw new DBException("", se);
! }
! }
!
! /**
! * Set EXPRESSO transaction mode for the current DBConnection.
! *
! * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
! * @since Expresso 5.3
! *
! * @throws DBException
! */
! public void setTransactionSerializableMode() throws DBException {
!
! try {
! setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
! } catch (DBException se) {
! throw new DBException("", se);
! }
! }
!
! /**
! * Trim or not trim parameter set for this connection
! *
! * @return boolean True if the connection not trim the persistence string.
! * false if the persistence string will have to be trimmed
! */
! public boolean isStringNotTrim() {
! return myJdbc.isStringNotTrim();
! } /* isStringNotTrimmed() */
!
! /**
! * Trim or not trim parameter set for this connection
! *
! * @return boolean True if the connection not trim the persistence string.
! * false if the persistence string will have to be trimmed
! */
! public boolean isTransactionNotActive() {
! return myJdbc.isTransactionNotActive();
! } /* isTransactionNotActive() */
!
!
! /**
! * @param config
! */
! public void setJDBCCondig(JDBCConfig config) {
! myJdbc = config;
! }
!
! }
!
! /* DBConnection */
--- 2307,2309 ----
}
! } /* DBConnection */
Index: TableCreator.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/db/TableCreator.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** TableCreator.java 18 Sep 2004 00:04:43 -0000 1.12
--- TableCreator.java 20 Sep 2004 19:21:48 -0000 1.13
***************
*** 26,32 ****
* @author Michael Rimov
* @version $Revision$ on $Date$
- *
- * Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
- * @since $DatabaseSchema $Date$
*/
--- 26,29 ----
***************
*** 88,94 ****
* @todo Refactor this method into smaller chunks... ie creating the table.
* Creating
- *
- * Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
- * @since $DatabaseSchema $Date$
*/
public synchronized void createTable(DBObject dbObj) throws DBException {
--- 85,88 ----
***************
*** 128,132 ****
myDBDriver.equals("org.postgresql.Driver")) {
sqlStatement.append(", CONSTRAINT pk");
! sqlStatement.append(metadata.getTargetSQLTable(dbObj.getDataContext()));
sqlStatement.append(" PRIMARY KEY (");
addComma = false;
--- 122,126 ----
myDBDriver.equals("org.postgresql.Driver")) {
sqlStatement.append(", CONSTRAINT pk");
! sqlStatement.append(metadata.getTargetTable());
sqlStatement.append(" PRIMARY KEY (");
addComma = false;
***************
*** 163,167 ****
} else {
pkStatement.append("alter table ");
! pkStatement.append(metadata.getTargetSQLTable(dbObj.getDataContext()));
pkStatement.append(" add primary key(");
addComma = false;
--- 157,161 ----
} else {
pkStatement.append("alter table ");
! pkStatement.append(metadata.getTargetTable());
pkStatement.append(" add primary key(");
addComma = false;
***************
*** 228,234 ****
* @return FastStringBuffer with the create statements added
* @throws DBException upon creation error
- *
- * Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
- * @since $DatabaseSchema $Date$
*/
protected FastStringBuffer createTableSQLDefinition(DBObject dbObj,
--- 222,225 ----
***************
*** 257,261 ****
}
sqlStatement.append(" TABLE ");
! sqlStatement.append(metadata.getTargetSQLTable(dbObj.getDataContext()));
sqlStatement.append("(");
--- 248,252 ----
}
sqlStatement.append(" TABLE ");
! sqlStatement.append(metadata.getTargetTable());
sqlStatement.append("(");
***************
*** 311,317 ****
* @throws DBException If the create process fails
* @return A Vector containing the created dbObjects
- *
- * Modify by Yves Henri AMAIZO <amy_amaizo at compuserve.com>
- * @since $DatabaseSchema $Date$
*/
public synchronized Vector createAsNeeded(Schema oneSchema, String dataContext)
--- 302,305 ----
***************
*** 346,350 ****
if (log.isInfoEnabled()) {
! log.info("Verifying table " + metadata.getTargetSQLTable(oneMember.getDataContext()) + " exists");
}
--- 334,338 ----
if (log.isInfoEnabled()) {
! log.info("Verifying table " + metadata.getTargetTable() + " exists");
}
***************
*** 356,360 ****
if (log.isInfoEnabled()) {
! log.info("Table " + metadata.getTargetSQLTable(oneMember.getDataContext()) + " is OK");
}
} catch (DBException de) {
--- 344,348 ----
if (log.isInfoEnabled()) {
! log.info("Table " + metadata.getTargetTable() + " is OK");
}
} catch (DBException de) {
***************
*** 372,379 ****
oneMember.count();
} catch (DBException de2) {
! throw new DBException("Table '" +
! metadata.getTargetSQLTable(oneMember.getDataContext()) +
! "' was not created successfully in db '" +
! oneMember.getDataContext() + "'", de2);
}
}
--- 360,367 ----
oneMember.count();
} catch (DBException de2) {
! throw new DBException("Table '" +
! metadata.getTargetTable() +
! "' was not created successfully in db '" +
! oneMember.getDataContext() + "'", de2);
}
}
Index: DBConfig.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/db/DBConfig.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DBConfig.java 18 Sep 2004 00:04:43 -0000 1.5
--- DBConfig.java 20 Sep 2004 19:21:48 -0000 1.6
***************
*** 297,299 ****
}
! }
\ No newline at end of file
--- 297,299 ----
}
! }
Index: DBConnectionPool.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/db/DBConnectionPool.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** DBConnectionPool.java 18 Sep 2004 00:04:43 -0000 1.49
--- DBConnectionPool.java 20 Sep 2004 19:21:48 -0000 1.50
***************
*** 83,87 ****
import java.util.ArrayList;
- import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
--- 83,86 ----
***************
*** 128,132 ****
* Name of this class
*/
! private static final String THIS_CLASS = DBConnectionPool.class.getName() + ".";
--- 127,131 ----
* Name of this class
*/
! private static final String THIS_CLASS = DBConnectionPool.class.getName();
***************
*** 400,404 ****
nextConnectionId++;
oneConnection.setDescription("New Connection");
- oneConnection.setJDBCCondig(this.getJDBCConfig(getDataContext()));
return oneConnection;
}
--- 399,402 ----
***************
*** 550,559 ****
//hand out stale connections in the long run.
//
! if ((dbc.getCreatedTime() + maxttl < startTime) && !dbc.getImmortal()) {
try {
- if (dbc.isClosed()) {
- log.error("Error !!!!!!!!: disconnecting the connection '" + dbc.getId() +
- "' now dead in pool '" + getDataContext() + "'");
- }
dbc.disconnect();
} catch (Throwable ex) {
--- 548,553 ----
//hand out stale connections in the long run.
//
! if (dbc.getCreatedTime() + maxttl < startTime) {
try {
dbc.disconnect();
} catch (Throwable ex) {
***************
*** 617,621 ****
/* it's been too long */
if (log.isDebugEnabled()) {
! log.debug("Checking to close connection");
}
--- 611,615 ----
/* it's been too long */
if (log.isDebugEnabled()) {
! log.debug("Closing connection");
}
***************
*** 623,627 ****
if (log.isDebugEnabled()) {
log.debug("Connection "
! + oneConnection.getDescription() + " '" + oneConnection.getId() + "'"
+ " was idle more than " + (interval / 1000)
+ " seconds and was returned to the pool. "
--- 617,621 ----
if (log.isDebugEnabled()) {
log.debug("Connection "
! + oneConnection.getDescription()
+ " was idle more than " + (interval / 1000)
+ " seconds and was returned to the pool. "
***************
*** 637,641 ****
} else {
log.warn("Warning: 'Immortal' Connection "
! + oneConnection.getDescription() + " '" + oneConnection.getId() + "'"
+ " was idle more than " + (interval / 1000)
+ " seconds. "
--- 631,635 ----
} else {
log.warn("Warning: 'Immortal' Connection "
! + oneConnection.getDescription()
+ " was idle more than " + (interval / 1000)
+ " seconds. "
***************
*** 650,667 ****
/* If the connection is (interval * 3) MINUTES old, then close it */
timeOutTime = lastTouched + (interval * 60 * 3);
! if (now > timeOutTime && !oneConnection.getImmortal()) {
/* set this boolean to true, so that the connections are removed after iteration*/
bCheckToRemove = true;
- if (log.isDebugEnabled()) {
- log.debug("Connection "
- + oneConnection.getDescription() + " '" + oneConnection.getId() + "'"
- + " was idle more than " + (interval * 60 * 3 / 1000)
- + " minutes and was disconnected and removed "
- + "from the pool");
- }
log.warn("Connection "
! + oneConnection.getDescription() + " '" + oneConnection.getId() + "'"
! + " was idle more than " + (interval * 60 * 3 / 1000)
+ " minutes and was disconnected and removed "
+ "from the pool");
--- 644,654 ----
/* If the connection is (interval * 3) MINUTES old, then close it */
timeOutTime = lastTouched + (interval * 60 * 3);
! if (now > timeOutTime) {
/* set this boolean to true, so that the connections are removed after iteration*/
bCheckToRemove = true;
log.warn("Connection "
! + oneConnection.getDescription()
! + " was idle more than " + (interval / 1000)
+ " minutes and was disconnected and removed "
+ "from the pool");
***************
*** 675,704 ****
connectionsToBeRemoved.add(new Integer(oneConnection.getId()));
! // Added to solve deadlock problem when used in mode transactional mode.
! // The connection was disconnect and release from the pool after the force of
! // completion of the process on going. Rollback id done before the disconnect and if
! // the the connection is not immortal by the user.
! // Notification log message is send to advise the system adminitrator in case
! // the connection is explicitly set to immortal.
! // Yves Henri AMAIZO 15/01/2004 16:28
!
! if (!oneConnection.getAutoCommit()) {
! oneConnection.rollback();
! if (log.isDebugEnabled()) {
! log.debug("Connection <in Transaction Mode> <not immortal>"
! + oneConnection.getDescription() + " '" + oneConnection.getId() + "'"
! + " is rolled back because idle more than and not immortal" + (interval * 60 * 3 / 1000)
! + " minutes and will be disconnected and removed "
! + "from the pool");
! }
- log.warn("Connection <in Transaction Mode> <not immortal>"
- + oneConnection.getDescription() + " '" + oneConnection.getId() + "'"
- + oneConnection.getDescription()
- + " is rolled back because idle more than and not immortal" + (interval * 60 * 3 / 1000)
- + " minutes and was disconnected and removed "
- + "from the pool");
- }
- oneConnection.disconnect();
}
} /* for each connection in the pool */
--- 662,667 ----
connectionsToBeRemoved.add(new Integer(oneConnection.getId()));
! oneConnection.disconnect();
}
} /* for each connection in the pool */
***************
*** 1564,1569 ****
jndiDS.setupContext();
} catch (DSException dse) {
! throw new ConnectionPoolException(myName + ":Cannot initialize jndi Context Factory" +
! " <Error:" + dse.getMessage() + ">");
}
}
--- 1527,1531 ----
jndiDS.setupContext();
} catch (DSException dse) {
! throw new ConnectionPoolException(myName + ":Cannot initialize jndi Context Factory");
}
}
More information about the cvs
mailing list