Lines 874-884
public class JDBCStore extends StoreBase {
Link Here
|
874 |
* @return <code>Connection</code> if the connection succeeded |
874 |
* @return <code>Connection</code> if the connection succeeded |
875 |
*/ |
875 |
*/ |
876 |
protected Connection getConnection() { |
876 |
protected Connection getConnection() { |
|
|
877 |
Connection _conn = null; |
877 |
try { |
878 |
try { |
878 |
if (dbConnection == null || dbConnection.isClosed()) { |
879 |
_conn = open(); |
|
|
880 |
if (_conn == null || _conn.isClosed()) { |
879 |
manager.getContainer().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBClosed")); |
881 |
manager.getContainer().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBClosed")); |
880 |
open(); |
882 |
_conn = open(); |
881 |
if (dbConnection == null || dbConnection.isClosed()) { |
883 |
if (_conn == null || _conn.isClosed()) { |
882 |
manager.getContainer().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBReOpenFail")); |
884 |
manager.getContainer().getLogger().info(sm.getString(getStoreName() + ".checkConnectionDBReOpenFail")); |
883 |
} |
885 |
} |
884 |
} |
886 |
} |
Lines 887-893
public class JDBCStore extends StoreBase {
Link Here
|
887 |
ex.toString())); |
889 |
ex.toString())); |
888 |
} |
890 |
} |
889 |
|
891 |
|
890 |
return dbConnection; |
892 |
return _conn; |
891 |
} |
893 |
} |
892 |
|
894 |
|
893 |
/** |
895 |
/** |
Lines 916-923
public class JDBCStore extends StoreBase {
Link Here
|
916 |
} |
918 |
} |
917 |
|
919 |
|
918 |
if (dataSource != null) { |
920 |
if (dataSource != null) { |
919 |
dbConnection = dataSource.getConnection(); |
921 |
Connection _conn = dataSource.getConnection(); |
920 |
return dbConnection; |
922 |
return _conn; |
921 |
} |
923 |
} |
922 |
|
924 |
|
923 |
// Instantiate our database driver if necessary |
925 |
// Instantiate our database driver if necessary |
Lines 1014-1026
public class JDBCStore extends StoreBase {
Link Here
|
1014 |
} |
1016 |
} |
1015 |
|
1017 |
|
1016 |
/** |
1018 |
/** |
1017 |
* Release the connection, not needed here since the |
1019 |
* Release the connection, if it |
1018 |
* connection is not associated with a connection pool. |
1020 |
* is associated with a connection pool. |
1019 |
* |
1021 |
* |
1020 |
* @param conn The connection to be released |
1022 |
* @param conn The connection to be released |
1021 |
*/ |
1023 |
*/ |
1022 |
protected void release(Connection conn) { |
1024 |
protected void release(Connection conn) { |
1023 |
// NOOP |
1025 |
if (dataSource != null) { |
|
|
1026 |
close(conn); |
1027 |
} |
1024 |
} |
1028 |
} |
1025 |
|
1029 |
|
1026 |
/** |
1030 |
/** |
Lines 1034-1040
public class JDBCStore extends StoreBase {
Link Here
|
1034 |
protected synchronized void startInternal() throws LifecycleException { |
1038 |
protected synchronized void startInternal() throws LifecycleException { |
1035 |
|
1039 |
|
1036 |
// Open connection to the database |
1040 |
// Open connection to the database |
1037 |
this.dbConnection = getConnection(); |
1041 |
Connection _conn = getConnection(); |
|
|
1042 |
if (dataSource != null) { |
1043 |
// if connection was created by a dataSource, we will release it |
1044 |
close(_conn); |
1045 |
} else { |
1046 |
this.dbConnection = _conn; |
1047 |
} |
1038 |
|
1048 |
|
1039 |
super.startInternal(); |
1049 |
super.startInternal(); |
1040 |
} |
1050 |
} |