Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9e29b32e
Commit
9e29b32e
authored
Mar 25, 2003
by
Dave Cramer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patch to notify listeners on error from Csaba Nagy
parent
f1792b93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
17 deletions
+32
-17
src/interfaces/jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
...c/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
+32
-17
No files found.
src/interfaces/jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java
View file @
9e29b32e
...
...
@@ -13,7 +13,8 @@ import org.postgresql.PGConnection;
* @see ConnectionPool
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
* @version $Revision: 1.6 $
* @author Csaba Nagy (ncsaba@yahoo.com)
* @version $Revision: 1.7 $
*/
public
class
PooledConnectionImpl
implements
PooledConnection
{
...
...
@@ -95,33 +96,47 @@ public class PooledConnectionImpl implements PooledConnection
{
if
(
con
==
null
)
{
throw
new
SQLException
(
"This PooledConnection has already been closed!"
);
// Before throwing the exception, let's notify the registered listeners about the error
final
SQLException
sqlException
=
new
SQLException
(
"This PooledConnection has already been closed!"
);
fireConnectionFatalError
(
sqlException
);
throw
sqlException
;
}
// Only one connection can be open at a time from this PooledConnection. See JDBC 2.0 Optional Package spec section 6.2.3
if
(
last
!=
null
)
// If any error occures while opening a new connection, the listeners
// have to be notified. This gives a chance to connection pools to
// elliminate bad pooled connections.
try
{
last
.
close
();
if
(
!
con
.
getAutoCommit
()
)
// Only one connection can be open at a time from this PooledConnection. See JDBC 2.0 Optional Package spec section 6.2.3
if
(
last
!=
null
)
{
try
last
.
close
();
if
(!
con
.
getAutoCommit
())
{
con
.
rollback
();
try
{
con
.
rollback
();
}
catch
(
SQLException
e
)
{}
}
catch
(
SQLException
e
)
{}
con
.
clearWarnings
();
}
con
.
clearWarnings
();
con
.
setAutoCommit
(
autoCommit
);
}
catch
(
SQLException
sqlException
)
{
fireConnectionFatalError
(
sqlException
);
throw
(
SQLException
)
sqlException
.
fillInStackTrace
();
}
con
.
setAutoCommit
(
autoCommit
);
ConnectionHandler
handler
=
new
ConnectionHandler
(
con
);
last
=
handler
;
Connection
con
=
(
Connection
)
Proxy
.
newProxyInstance
(
getClass
().
getClassLoader
(),
new
Class
[]{
Connection
.
class
,
PGConnection
.
class
},
handler
);
last
.
setProxy
(
con
);
return
con
;
last
.
setProxy
(
con
);
return
con
;
}
/**
* Used to fire a connection event to all listeners.
* Used to fire a connection
closed
event to all listeners.
*/
void
fireConnectionClosed
()
{
...
...
@@ -140,7 +155,7 @@ public class PooledConnectionImpl implements PooledConnection
}
/**
* Used to fire a connection event to all listeners.
* Used to fire a connection e
rror e
vent to all listeners.
*/
void
fireConnectionFatalError
(
SQLException
e
)
{
...
...
@@ -363,7 +378,7 @@ public class PooledConnectionImpl implements PooledConnection
}
else
{
try
try
{
return
method
.
invoke
(
st
,
args
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment