Java Code Examples for javax.sql.StatementEventListener#statementErrorOccurred()

The following examples show how to use javax.sql.StatementEventListener#statementErrorOccurred() . 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: 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 3
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 4
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 5
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 6
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 7
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 8
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 9
Source File: EmbedXAConnection40.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: ClientPooledConnection40.java    From gemfirexd-oss with Apache License 2.0 3 votes vote down vote up
/**
 *
 * Raise the statementErrorOccurred event for all the listeners when the 
 * corresponding events occurs.
 *
 * @param statement The PreparedStatement on which error occurred
 * @param sqle      The SQLException associated with the error that
 *                  caused the invalidation of the PreparedStatements
 *
 */
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 11
Source File: ClientXAConnection40.java    From gemfirexd-oss with Apache License 2.0 3 votes vote down vote up
/**
 *
 * Raise the statementErrorOccurred event for all the listeners when the 
 * corresponding events occurs.
 *
 * @param statement The PreparedStatement on which error occurred
 * @param sqle      The SQLException associated with the error that
 *                  caused the invalidation of the PreparedStatements
 *
 */
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 12
Source File: ClientPooledConnection40.java    From gemfirexd-oss with Apache License 2.0 3 votes vote down vote up
/**
 *
 * Raise the statementErrorOccurred event for all the listeners when the 
 * corresponding events occurs.
 *
 * @param statement The PreparedStatement on which error occurred
 * @param sqle      The SQLException associated with the error that
 *                  caused the invalidation of the PreparedStatements
 *
 */
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 13
Source File: ClientXAConnection40.java    From gemfirexd-oss with Apache License 2.0 3 votes vote down vote up
/**
 *
 * Raise the statementErrorOccurred event for all the listeners when the 
 * corresponding events occurs.
 *
 * @param statement The PreparedStatement on which error occurred
 * @param sqle      The SQLException associated with the error that
 *                  caused the invalidation of the PreparedStatements
 *
 */
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 14
Source File: ClientPooledConnection40.java    From spliceengine with GNU Affero General Public License v3.0 3 votes vote down vote up
/**
 *
 * Raise the statementErrorOccurred event for all the listeners when the 
 * corresponding events occurs.
 *
 * @param statement The PreparedStatement on which error occurred
 * @param sqle      The SQLException associated with the error that
 *                  caused the invalidation of the PreparedStatements
 *
 */
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 15
Source File: ClientXAConnection40.java    From spliceengine with GNU Affero General Public License v3.0 3 votes vote down vote up
/**
 *
 * Raise the statementErrorOccurred event for all the listeners when the 
 * corresponding events occurs.
 *
 * @param statement The PreparedStatement on which error occurred
 * @param sqle      The SQLException associated with the error that
 *                  caused the invalidation of the PreparedStatements
 *
 */
public void onStatementErrorOccurred(PreparedStatement statement,
                SQLException sqle) {
    if (!statementEventListeners.isEmpty()) {
        StatementEvent event = new StatementEvent(this,statement,sqle);
        for (StatementEventListener l : statementEventListeners) {
            l.statementErrorOccurred(event);
        }
    }
}