本文整理了Java中javax.sql.ConnectionEvent.getSQLException()
方法的一些代码示例,展示了ConnectionEvent.getSQLException()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConnectionEvent.getSQLException()
方法的具体详情如下:
包路径:javax.sql.ConnectionEvent
类名称:ConnectionEvent
方法名:getSQLException
[英]Gets the SQLException which holds information about the error which occurred in the PooledConnection.
[中]获取SQLException,该异常保存有关PooledConnection中发生的错误的信息。
代码示例来源:origin: org.tranql/tranql-connector
public void connectionErrorOccurred(ConnectionEvent event) {
Exception e = event.getSQLException();
unfilteredConnectionError(e);
}
});
代码示例来源:origin: org.tranql/tranql-connector
public void connectionErrorOccurred(ConnectionEvent event) {
Exception e = event.getSQLException();
unfilteredConnectionError(e);
}
});
代码示例来源:origin: com.caucho/resin
@Override
public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
{
sendFatalEvent(event.getSQLException());
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-connector
public void connectionErrorOccurred(javax.sql.ConnectionEvent ce)
{
SQLException ex = ce.getSQLException();
broadcastConnectionError(ex);
}
});
代码示例来源:origin: org.bytesoft/bytejta-supports
public void connectionClosed(ConnectionEvent event) {
Iterator<ConnectionEventListener> itr = this.connectionEventListeners.iterator();
while (itr.hasNext()) {
ConnectionEventListener listener = itr.next();
SQLException sqlException = event.getSQLException();
ConnectionEvent connectionEvent = new ConnectionEvent(this, sqlException);
try {
listener.connectionClosed(connectionEvent);
} catch (RuntimeException error) {
logger.warn("Error occurred!", error);
}
} // end-while (itr.hasNext())
}
代码示例来源:origin: liuyangming/ByteJTA
public void connectionErrorOccurred(ConnectionEvent event) {
Iterator<ConnectionEventListener> itr = this.connectionEventListeners.iterator();
while (itr.hasNext()) {
ConnectionEventListener listener = itr.next();
SQLException sqlException = event.getSQLException();
ConnectionEvent connectionEvent = new ConnectionEvent(this, sqlException);
try {
listener.connectionErrorOccurred(connectionEvent);
} catch (RuntimeException error) {
logger.warn("Error occurred!", error);
}
} // end-while (itr.hasNext())
}
代码示例来源:origin: liuyangming/ByteJTA
public void connectionClosed(ConnectionEvent event) {
Iterator<ConnectionEventListener> itr = this.connectionEventListeners.iterator();
while (itr.hasNext()) {
ConnectionEventListener listener = itr.next();
SQLException sqlException = event.getSQLException();
ConnectionEvent connectionEvent = new ConnectionEvent(this, sqlException);
try {
listener.connectionClosed(connectionEvent);
} catch (RuntimeException error) {
logger.warn("Error occurred!", error);
}
} // end-while (itr.hasNext())
}
代码示例来源:origin: org.bytesoft/bytejta-supports
public void connectionErrorOccurred(ConnectionEvent event) {
Iterator<ConnectionEventListener> itr = this.connectionEventListeners.iterator();
while (itr.hasNext()) {
ConnectionEventListener listener = itr.next();
SQLException sqlException = event.getSQLException();
ConnectionEvent connectionEvent = new ConnectionEvent(this, sqlException);
try {
listener.connectionErrorOccurred(connectionEvent);
} catch (RuntimeException error) {
logger.warn("Error occurred!", error);
}
} // end-while (itr.hasNext())
}
代码示例来源:origin: org.apache.commons/commons-dbcp2
/**
* If a fatal error occurs, close the underlying physical connection so as not to be returned in the future
*/
@Override
public void connectionErrorOccurred(final ConnectionEvent event) {
final PooledConnection pc = (PooledConnection) event.getSource();
if (null != event.getSQLException()) {
System.err.println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" + event.getSQLException() + ")");
}
pc.removeConnectionEventListener(this);
final PooledConnectionAndInfo pci = pcMap.get(pc);
if (pci == null) {
throw new IllegalStateException(NO_KEY_MESSAGE);
}
try {
pool.invalidateObject(pci);
} catch (final Exception e) {
System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + pci);
e.printStackTrace();
}
}
代码示例来源:origin: wxbty/meepo
public void connectionClosed(ConnectionEvent event) {
for (Iterator<ConnectionEventListener> itr = this.listeners.iterator(); itr.hasNext();) {
ConnectionEventListener listener = itr.next();
try {
listener.connectionClosed(new ConnectionEvent(this, event.getSQLException()));
} catch (RuntimeException rex) {
logger.warn(rex.getMessage(), rex);
}
} // end-for (Iterator<ConnectionEventListener> itr = this.listeners.iterator(); itr.hasNext();)
this.firePhysicalConnectionClosed(event); // removeConnectionEventListener
}
代码示例来源:origin: wxbty/meepo
public void connectionErrorOccurred(ConnectionEvent event) {
for (Iterator<ConnectionEventListener> itr = this.listeners.iterator(); itr.hasNext();) {
ConnectionEventListener listener = itr.next();
try {
listener.connectionErrorOccurred(new ConnectionEvent(this, event.getSQLException()));
} catch (RuntimeException rex) {
logger.warn(rex.getMessage(), rex);
}
} // end-for (Iterator<ConnectionEventListener> itr = this.listeners.iterator(); itr.hasNext();)
this.firePhysicalConnectionClosed(event); // removeConnectionEventListener
}
代码示例来源:origin: org.apache.tomcat/tomcat-dbcp
/**
* If a fatal error occurs, close the underlying physical connection so as not to be returned in the future
*/
@Override
public void connectionErrorOccurred(final ConnectionEvent event) {
final PooledConnection pc = (PooledConnection) event.getSource();
if (null != event.getSQLException()) {
System.err.println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" + event.getSQLException() + ")");
}
pc.removeConnectionEventListener(this);
final PooledConnectionAndInfo pci = pcMap.get(pc);
if (pci == null) {
throw new IllegalStateException(NO_KEY_MESSAGE);
}
try {
pool.invalidateObject(pci);
} catch (final Exception e) {
System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + pci);
e.printStackTrace();
}
}
代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.commons-dbcp
/**
* If a fatal error occurs, close the underlying physical connection so as
* not to be returned in the future
*/
public void connectionErrorOccurred(ConnectionEvent event) {
PooledConnection pc = (PooledConnection)event.getSource();
if (null != event.getSQLException()) {
System.err.println(
"CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR ("
+ event.getSQLException() + ")");
}
pc.removeConnectionEventListener(this);
Object info = pcMap.get(pc);
if (info == null) {
throw new IllegalStateException(NO_KEY_MESSAGE);
}
try {
_pool.invalidateObject(info);
} catch (Exception e) {
System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + info);
e.printStackTrace();
}
}
代码示例来源:origin: net.sf.jt400/jt400
/**
Notifies this ConnectionEventListener that a fatal error has occurred and the pooled connection can no longer be used. The driver makes this notification just before it throws the application the SQLException contained in the given ConnectionEvent object.
@param event An event object describing the source of the event and containing the SQLException that the driver is about to throw.
**/
public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
{
logException("connectionErrorOccurred", event.getSQLException());
if (DEBUG || GATHER_STATS) connectionErrorsOccurred_++;
// Note: (From the JDBC Tutorial, bottom of p. 640:) "... the driver will notify the connection pooling module when the Connection object ... is unusable because of a fatal error".
// This event does _not_ cause the pool manager to remove the connection from the pool, or to close the physical connection. The manager will simply make note that this connection is not to be re-used, if/when it gets returned to the pool.
if (poolClosed_) return;
pauseIfPoolPaused(0); // if pool is paused, wait until unpause() is called
AS400JDBCPooledConnection conn = (AS400JDBCPooledConnection) event.getSource();
activeConnectionsInError_.add(conn); // track this connection until it gets closed
}
代码示例来源:origin: org.apache.commons/commons-dbcp2
/**
* If a fatal error occurs, close the underlying physical connection so as not to be returned in the future
*/
@Override
public void connectionErrorOccurred(final ConnectionEvent event) {
final PooledConnection pc = (PooledConnection) event.getSource();
if (null != event.getSQLException()) {
System.err.println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" + event.getSQLException() + ")");
}
pc.removeConnectionEventListener(this);
final PooledConnectionAndInfo info = pcMap.get(pc);
if (info == null) {
throw new IllegalStateException(NO_KEY_MESSAGE);
}
try {
pool.invalidateObject(info.getUserPassKey(), info);
} catch (final Exception e) {
System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + info);
e.printStackTrace();
}
}
代码示例来源:origin: org.javasimon/javasimon-jdbc41
@Override
public void connectionErrorOccurred(ConnectionEvent event) {
originalListener.connectionErrorOccurred(new ConnectionEvent(SimonPooledConnection.this, event.getSQLException()));
}
}
代码示例来源:origin: ha-jdbc/ha-jdbc
private ConnectionEvent getEvent(ConnectionEvent event)
{
Object source = event.getSource();
C connection = this.proxyFactory.get(this.database);
if (Proxy.isProxyClass(source.getClass()) && Proxy.getInvocationHandler(source) instanceof AbstractPooledConnectionInvocationHandler)
{
return new ConnectionEvent(connection, event.getSQLException());
}
return event.getSource().equals(connection) ? event : null;
}
}
代码示例来源:origin: org.apache.openjpa/openjpa-all
/**
* If a fatal error occurs, close the underlying physical connection so as
* not to be returned in the future
*/
public void connectionErrorOccurred(ConnectionEvent event) {
PooledConnection pc = (PooledConnection)event.getSource();
if (null != event.getSQLException()) {
System.err
.println("CLOSING DOWN CONNECTION DUE TO INTERNAL ERROR (" +
event.getSQLException() + ")");
}
pc.removeConnectionEventListener(this);
PooledConnectionAndInfo info = (PooledConnectionAndInfo) pcMap.get(pc);
if (info == null) {
throw new IllegalStateException(NO_KEY_MESSAGE);
}
try {
_pool.invalidateObject(info.getUserPassKey(), info);
} catch (Exception e) {
System.err.println("EXCEPTION WHILE DESTROYING OBJECT " + info);
e.printStackTrace();
}
}
代码示例来源:origin: org.javasimon/javasimon-jdbc41
@Override
public void connectionClosed(ConnectionEvent event) {
originalListener.connectionClosed(new ConnectionEvent(SimonPooledConnection.this, event.getSQLException()));
}
代码示例来源:origin: com.atomikos/transactions-jdbc-deprecated
public void connectionErrorOccurred ( ConnectionEvent e )
{
ResourceTransaction restx = unsetResourceTransaction ();
suspendResourceTransaction ( restx );
setInvalidated ();
ConnectionEvent e2 = new ConnectionEvent ( this, e.getSQLException () );
Enumeration enumm = listeners_.elements ();
while ( enumm.hasMoreElements () ) {
ConnectionEventListener l = (ConnectionEventListener) enumm
.nextElement ();
l.connectionErrorOccurred ( e2 );
}
}
内容来源于网络,如有侵权,请联系作者删除!