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

The following examples show how to use javax.sql.StatementEventListener#statementClosed() . 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: StatementHandler.java    From clearpool with GNU General Public License v3.0 6 votes vote down vote up
private void close() throws SQLException {
  try {
    this.statement.close();
  } catch (SQLException e) {
    this.handleException(e);
  }
  this.pooledConnection.removeStatement(this.statement);
  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.statementClosed(event);
      }
    }
  }
}
 
Example 2
Source File: PooledCassandraConnection.java    From cassandra-jdbc-wrapper with Apache License 2.0 6 votes vote down vote up
void statementClosed(CassandraPreparedStatement preparedStatement)
{
	StatementEvent event = new StatementEvent(this, preparedStatement);
	for (StatementEventListener listener : statementEventListeners)
	{
		listener.statementClosed(event);
	}

	String cql = preparedStatement.getCql();
	Set<CassandraPreparedStatement> freeStatements = freePreparedStatements.get(cql);
	Set<CassandraPreparedStatement> usedStatements = usedPreparedStatements.get(cql);

	usedStatements.remove(preparedStatement);
	
	preparedStatement.resetResults();
	try
	{
		preparedStatement.clearParameters();
		freeStatements.add(preparedStatement);
	}
	catch (SQLException e)
	{
		logger.error(e.getMessage());
	}

}
 
Example 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
Source File: EmbedPooledConnection40.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 PreparedStatement
 */
public void onStatementClose(PreparedStatement statement) {
    if (!statementEventListeners.isEmpty()){
        StatementEvent event = new StatementEvent(this,statement);
        for (StatementEventListener l : statementEventListeners) {
            l.statementClosed(event);
        }
    }
}
 
Example 12
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 13
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 14
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 15
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 16
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 17
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 18
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 19
Source File: JDBC4SuspendableXAConnection.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 20
Source File: JDBC4MysqlXAConnection.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);
        }
    }
}