javax.sql.StatementEventListener Java Examples

The following examples show how to use javax.sql.StatementEventListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PooledCassandraConnection.java    From cassandra-jdbc-wrapper with Apache License 2.0 6 votes vote down vote up
void statementErrorOccurred(CassandraPreparedStatement preparedStatement, SQLException sqlException)
{
	StatementEvent event = new StatementEvent(this, preparedStatement, sqlException);
	for (StatementEventListener listener : statementEventListeners)
	{
		listener.statementErrorOccurred(event);
	}
	
	String cql = preparedStatement.getCql();
	Set<CassandraPreparedStatement> usedStatements = usedPreparedStatements.get(cql);
	
	if (!(event.getSQLException() instanceof SQLRecoverableException))
	{
		preparedStatement.close();
		usedStatements.remove(preparedStatement);
	}
}
 
Example #2
Source File: ClientXAConnection40.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Raise the statementClosed event for all the listeners when the 
 * corresponding events occurs
 * @param statement The PreparedStatement that was closed
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()) {
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
Example #3
Source File: RMXAConnectionResource.java    From FHIR with Apache License 2.0 5 votes vote down vote up
@Override
public void addStatementEventListener(StatementEventListener listener) {
    log.entering(this.getClass().getName(), "addStatementEventListener");
    try {
        // Drive the method calls to each of the proxied XAConnections.
        List<XAConnection> connections = getProxiedXAConnections();
        for (XAConnection connection : connections) {
            connection.addStatementEventListener(listener);
        }
    } finally {
        log.exiting(this.getClass().getName(), "addStatementEventListener");
    }
}
 
Example #4
Source File: PoolConnectionImpl.java    From clearpool with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void addStatementEventListener(StatementEventListener listener) {
  if (this.statementEventListeners == null) {
    this.statementEventListeners = new ArrayList<StatementEventListener>();
  }
  this.statementEventListeners.add(listener);
}
 
Example #5
Source File: ClientPooledConnection40.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 *
 * Raise the statementClosed event for all the listeners when the 
 * corresponding events occurs.
 *
 * @param statement The PreparedStatement that was closed
 *
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()) {
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
Example #6
Source File: XAConnectionImpl.java    From ByteJTA with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void statementClosed(StatementEvent event) {
	Iterator<StatementEventListener> itr = this.statementEventListeners.iterator();
	while (itr.hasNext()) {
		StatementEventListener listener = itr.next();
		SQLException sqlException = event.getSQLException();
		PreparedStatement statement = event.getStatement();
		StatementEvent statementEvent = new StatementEvent(this, statement, sqlException);
		try {
			listener.statementClosed(statementEvent);
		} catch (RuntimeException error) {
			logger.warn("Error occurred!", error);
		}
	} // end-while (itr.hasNext())
}
 
Example #7
Source File: JDBC4MysqlPooledConnection.java    From r-course with MIT License 5 votes vote down vote up
void fireStatementEvent(StatementEvent event) throws SQLException {
    synchronized (this.statementEventListeners) {
        for (StatementEventListener listener : this.statementEventListeners.keySet()) {
            listener.statementClosed(event);
        }
    }
}
 
Example #8
Source File: JDBC4MysqlXAConnection.java    From Komondor with GNU General Public License v3.0 5 votes vote down vote up
void fireStatementEvent(StatementEvent event) throws SQLException {
    synchronized (this.statementEventListeners) {
        for (StatementEventListener listener : this.statementEventListeners.keySet()) {
            listener.statementClosed(event);
        }
    }
}
 
Example #9
Source File: EmbedPooledConnection40.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Raise the statementErrorOccurred event for all the listeners when the
 * corresponding events occurs
 * @param statement PreparedStatement
 * @param sqle      SQLException
 */
public void onStatementErrorOccurred(PreparedStatement statement,SQLException sqle) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement,sqle);
        for (StatementEventListener l : statementEventListeners) {
            l.statementErrorOccurred(event);
        }
    }
}
 
Example #10
Source File: JDBC4SuspendableXAConnection.java    From Komondor with GNU General Public License v3.0 5 votes vote down vote up
void fireStatementEvent(StatementEvent event) throws SQLException {
    synchronized (this.statementEventListeners) {
        for (StatementEventListener listener : this.statementEventListeners.keySet()) {
            listener.statementClosed(event);
        }
    }
}
 
Example #11
Source File: JDBC4MysqlPooledConnection.java    From Komondor with GNU General Public License v3.0 5 votes vote down vote up
void fireStatementEvent(StatementEvent event) throws SQLException {
    synchronized (this.statementEventListeners) {
        for (StatementEventListener listener : this.statementEventListeners.keySet()) {
            listener.statementClosed(event);
        }
    }
}
 
Example #12
Source File: ClientPooledConnection40.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 *
 * Raise the statementClosed event for all the listeners when the 
 * corresponding events occurs.
 *
 * @param statement The PreparedStatement that was closed
 *
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()) {
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
Example #13
Source File: EmbedXAConnection40.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Raise the statementClosed event for all the listeners when the
 * corresponding events occurs
 * @param statement PreparedStatement
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
Example #14
Source File: ClientXAConnection40.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Raise the statementClosed event for all the listeners when the 
 * corresponding events occurs
 * @param statement The PreparedStatement that was closed
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()) {
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
Example #15
Source File: EmbedXAConnection40.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Raise the statementClosed event for all the listeners when the
 * corresponding events occurs
 * @param statement PreparedStatement
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
Example #16
Source File: EmbedPooledConnection40.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Raise the statementErrorOccurred event for all the listeners when the
 * corresponding events occurs
 * @param statement PreparedStatement
 * @param sqle      SQLException
 */
public void onStatementErrorOccurred(PreparedStatement statement,SQLException sqle) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement,sqle);
        for (StatementEventListener l : statementEventListeners) {
            l.statementErrorOccurred(event);
        }
    }
}
 
Example #17
Source File: EmbedPooledConnection40.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Raise the statementClosed event for all the listeners when the
 * corresponding events occurs
 * @param statement PreparedStatement
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
Example #18
Source File: StatementHandler.java    From clearpool with GNU General Public License v3.0 5 votes vote down vote up
private SQLException handleException(SQLException e) throws SQLException {
  if (this.statement instanceof PreparedStatement) {
    List<StatementEventListener> statementEventListeners =
        this.pooledConnection.getStatementEventListeners();
    if (statementEventListeners != null) {
      StatementEvent event =
          new StatementEvent(this.pooledConnection, (PreparedStatement) this.statement);
      for (StatementEventListener listener : statementEventListeners) {
        listener.statementErrorOccurred(event);
      }
    }
  }
  throw e;
}
 
Example #19
Source File: XAConnectionImpl.java    From ByteJTA with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void statementErrorOccurred(StatementEvent event) {
	Iterator<StatementEventListener> itr = this.statementEventListeners.iterator();
	while (itr.hasNext()) {
		StatementEventListener listener = itr.next();
		SQLException sqlException = event.getSQLException();
		PreparedStatement statement = event.getStatement();
		StatementEvent statementEvent = new StatementEvent(this, statement, sqlException);
		try {
			listener.statementErrorOccurred(statementEvent);
		} catch (RuntimeException error) {
			logger.warn("Error occurred!", error);
		}
	} // end-while (itr.hasNext())
}
 
Example #20
Source File: MysqlPooledConnection.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
void fireStatementEvent(StatementEvent event) throws SQLException {
    synchronized (this.statementEventListeners) {
        for (StatementEventListener listener : this.statementEventListeners.keySet()) {
            listener.statementClosed(event);
        }
    }
}
 
Example #21
Source File: EmbedXAConnection40.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Raise the statementErrorOccurred event for all the listeners when the
 * corresponding events occurs
 * @param statement PreparedStatement
 * @param sqle      SQLException
 */
public void onStatementErrorOccurred(PreparedStatement statement,SQLException sqle) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement,sqle);
        for (StatementEventListener l : statementEventListeners) {
            l.statementErrorOccurred(event);
        }
    }
}
 
Example #22
Source File: EmbedPooledConnection40.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Raise the statementClosed event for all the listeners when the
 * corresponding events occurs
 * @param statement PreparedStatement
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
Example #23
Source File: TesterBasicXAConnection.java    From commons-dbcp with Apache License 2.0 4 votes vote down vote up
@Override
public void removeStatementEventListener(final StatementEventListener listener) {
    throw new UnsupportedOperationException();
}
 
Example #24
Source File: PooledConnectionProxy.java    From commons-dbcp with Apache License 2.0 4 votes vote down vote up
@Override
public void addStatementEventListener(final StatementEventListener listener) {
    if (!eventListeners.contains(listener)) {
        eventListeners.add(listener);
    }
}
 
Example #25
Source File: FBPooledConnection.java    From jaybird with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void addStatementEventListener(StatementEventListener listener) {
    throw new UnsupportedOperationException("Not yet implemented");
}
 
Example #26
Source File: LocalXADataSource.java    From carbon-commons with Apache License 2.0 4 votes vote down vote up
@Override
public void removeStatementEventListener(StatementEventListener listener) {
    //ignore
}
 
Example #27
Source File: SimonXAConnection.java    From javasimon with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void addStatementEventListener(StatementEventListener listener) {
	realConn.addStatementEventListener(listener);
}
 
Example #28
Source File: PooledConnectionImpl.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Override
public void addStatementEventListener(final StatementEventListener listener) {
    if (!statementEventListeners.contains(listener)) {
        statementEventListeners.add(listener);
    }
}
 
Example #29
Source File: ClientPooledConnection.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void addStatementEventListener(StatementEventListener listener){
    throw new UnsupportedOperationException();
}
 
Example #30
Source File: EmbedPooledConnection.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
public void addStatementEventListener(StatementEventListener listener) {
  throw new AssertionError("should have been overridden in JDBC 4.0");
}