本文整理了Java中javax.sql.ConnectionEvent.<init>()
方法的一些代码示例,展示了ConnectionEvent.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConnectionEvent.<init>()
方法的具体详情如下:
包路径:javax.sql.ConnectionEvent
类名称:ConnectionEvent
方法名:<init>
[英]Creates a connection event initialized with the supplied PooledConnection reporting that the application has closed the connection.
[中]创建使用提供的PooledConnection初始化的连接事件,报告应用程序已关闭连接。
代码示例来源:origin: org.postgresql/postgresql
protected ConnectionEvent createConnectionEvent(SQLException e) {
return new ConnectionEvent(this, e);
}
代码示例来源:origin: postgresql/postgresql
protected ConnectionEvent createConnectionEvent(SQLException sqle)
{
return new ConnectionEvent(this, sqle);
}
代码示例来源:origin: com.h2database/h2
/**
* INTERNAL
*/
void closedHandle() {
debugCode("closedHandle();");
ConnectionEvent event = new ConnectionEvent(this);
// go backward so that a listener can remove itself
// (otherwise we need to clone the list)
for (int i = listeners.size() - 1; i >= 0; i--) {
ConnectionEventListener listener = listeners.get(i);
listener.connectionClosed(event);
}
handleConn = null;
}
代码示例来源:origin: alibaba/druid
public void handleConnectionException(DruidPooledConnection pooledConnection, Throwable t, String sql) throws SQLException {
final DruidConnectionHolder holder = pooledConnection.getConnectionHolder();
errorCountUpdater.incrementAndGet(this);
lastError = t;
lastErrorTimeMillis = System.currentTimeMillis();
if (t instanceof SQLException) {
SQLException sqlEx = (SQLException) t;
// broadcastConnectionError
ConnectionEvent event = new ConnectionEvent(pooledConnection, sqlEx);
for (ConnectionEventListener eventListener : holder.getConnectionEventListeners()) {
eventListener.connectionErrorOccurred(event);
}
// exceptionSorter.isExceptionFatal
if (exceptionSorter != null && exceptionSorter.isExceptionFatal(sqlEx)) {
handleFatalError(pooledConnection, sqlEx, sql);
}
throw sqlEx;
} else {
throw new SQLException("Error", t);
}
}
代码示例来源:origin: alibaba/druid
public void syncClose() throws SQLException {
lock.lock();
try {
if (this.disable) {
return;
}
DruidConnectionHolder holder = this.holder;
if (holder == null) {
if (dupCloseLogEnable) {
LOG.error("dup close");
}
return;
}
for (ConnectionEventListener listener : holder.getConnectionEventListeners()) {
listener.connectionClosed(new ConnectionEvent(this));
}
DruidAbstractDataSource dataSource = holder.getDataSource();
List<Filter> filters = dataSource.getProxyFilters();
if (filters.size() > 0) {
FilterChainImpl filterChain = new FilterChainImpl(dataSource);
filterChain.dataSource_recycle(this);
} else {
recycle();
}
this.disable = true;
} finally {
lock.unlock();
}
}
代码示例来源:origin: alibaba/druid
listener.connectionClosed(new ConnectionEvent(this));
代码示例来源:origin: NLPchina/elasticsearch-sql
ConnectionEvent event = new ConnectionEvent(pooledConnection, sqlEx);
for (ConnectionEventListener eventListener : holder.getConnectionEventListeners()) {
eventListener.connectionErrorOccurred(event);
代码示例来源:origin: com.alibaba/druid
public void handleConnectionException(DruidPooledConnection pooledConnection, Throwable t, String sql) throws SQLException {
final DruidConnectionHolder holder = pooledConnection.getConnectionHolder();
errorCountUpdater.incrementAndGet(this);
lastError = t;
lastErrorTimeMillis = System.currentTimeMillis();
if (t instanceof SQLException) {
SQLException sqlEx = (SQLException) t;
// broadcastConnectionError
ConnectionEvent event = new ConnectionEvent(pooledConnection, sqlEx);
for (ConnectionEventListener eventListener : holder.getConnectionEventListeners()) {
eventListener.connectionErrorOccurred(event);
}
// exceptionSorter.isExceptionFatal
if (exceptionSorter != null && exceptionSorter.isExceptionFatal(sqlEx)) {
handleFatalError(pooledConnection, sqlEx, sql);
}
throw sqlEx;
} else {
throw new SQLException("Error", t);
}
}
代码示例来源:origin: com.alibaba/druid
public void syncClose() throws SQLException {
lock.lock();
try {
if (this.disable) {
return;
}
DruidConnectionHolder holder = this.holder;
if (holder == null) {
if (dupCloseLogEnable) {
LOG.error("dup close");
}
return;
}
for (ConnectionEventListener listener : holder.getConnectionEventListeners()) {
listener.connectionClosed(new ConnectionEvent(this));
}
DruidAbstractDataSource dataSource = holder.getDataSource();
List<Filter> filters = dataSource.getProxyFilters();
if (filters.size() > 0) {
FilterChainImpl filterChain = new FilterChainImpl(dataSource);
filterChain.dataSource_recycle(this);
} else {
recycle();
}
this.disable = true;
} finally {
lock.unlock();
}
}
代码示例来源:origin: com.alibaba/druid
listener.connectionClosed(new ConnectionEvent(this));
代码示例来源:origin: org.mariadb.jdbc/mariadb-java-client
/**
* Fire Connection close to listening listeners.
*/
public void fireConnectionClosed() {
ConnectionEvent event = new ConnectionEvent(this);
for (ConnectionEventListener listener : connectionEventListeners) {
listener.connectionClosed(event);
}
}
代码示例来源:origin: com.bbossgroups/bboss-persistent
/**
* sends a connectionClosed event.
*/
void notifyListeners() {
ConnectionEvent event = new ConnectionEvent(this);
Object[] listeners = eventListeners.toArray();
for (Object listener : listeners) {
((ConnectionEventListener) listener).connectionClosed(event);
}
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* sends a connectionClosed event.
*/
void notifyListeners() {
ConnectionEvent event = new ConnectionEvent(this);
Object[] listeners = eventListeners.toArray();
for (Object listener : listeners) {
((ConnectionEventListener) listener).connectionClosed(event);
}
}
代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.commons-dbcp
/**
* sends a connectionClosed event.
*/
void notifyListeners() {
ConnectionEvent event = new ConnectionEvent(this);
Object[] listeners = eventListeners.toArray();
for (int i = 0; i < listeners.length; i++) {
((ConnectionEventListener) listeners[i]).connectionClosed(event);
}
}
代码示例来源:origin: org.mariadb.jdbc/mariadb-java-client
/**
* Fire connection error to listening listeners.
*
* @param ex exception
*/
public void fireConnectionErrorOccured(SQLException ex) {
ConnectionEvent event = new ConnectionEvent(this, ex);
for (ConnectionEventListener listener : connectionEventListeners) {
listener.connectionErrorOccurred(event);
}
}
代码示例来源:origin: com.mchange/mchange-commons-java
public synchronized void fireConnectionClosed()
{
ConnectionEvent evt = new ConnectionEvent(source);
for (Iterator i = mlisteners.iterator(); i.hasNext();)
{
ConnectionEventListener cl = (ConnectionEventListener) i.next();
cl.connectionClosed(evt);
}
}
代码示例来源:origin: org.apache-extras.cassandra-jdbc/cassandra-jdbc
void connectionClosed()
{
ConnectionEvent event = new ConnectionEvent(this);
for (ConnectionEventListener listener : connectionEventListeners)
{
listener.connectionClosed(event);
}
}
代码示例来源:origin: org.codehaus.btm/btm
private void fireCloseEvent() {
if (log.isDebugEnabled()) log.debug("notifying " + connectionEventListeners.size() + " connectionEventListeners(s) about closing of " + this);
for (ConnectionEventListener connectionEventListener : connectionEventListeners) {
XAConnection conn = (XAConnection) Proxy.newProxyInstance(ClassLoaderUtils.getClassLoader(), new Class[]{XAConnection.class}, this);
connectionEventListener.connectionClosed(new ConnectionEvent(conn));
}
}
代码示例来源:origin: c3p0/c3p0
public void fireConnectionClosed()
{
Set mlCopy;
synchronized (this)
{ mlCopy = (Set) mlisteners.clone(); }
ConnectionEvent evt = new ConnectionEvent(source);
for (Iterator i = mlCopy.iterator(); i.hasNext();)
{
ConnectionEventListener cl = (ConnectionEventListener) i.next();
cl.connectionClosed(evt);
}
}
代码示例来源:origin: com.mchange.c3p0/com.springsource.com.mchange.v2.c3p0
public void fireConnectionClosed()
{
Set mlCopy;
synchronized (this)
{ mlCopy = (Set) mlisteners.clone(); }
ConnectionEvent evt = new ConnectionEvent(source);
for (Iterator i = mlCopy.iterator(); i.hasNext();)
{
ConnectionEventListener cl = (ConnectionEventListener) i.next();
cl.connectionClosed(evt);
}
}
内容来源于网络,如有侵权,请联系作者删除!