Java Reference
In-Depth Information
* The PreparedStatements that are assigned to each
* thread.
*/
private List<PreparedStatement> statementCache = new ArrayList<P
reparedStatement>();
/**
* Construct a repeatable statement based on the
* specified SQL
* @param sql The SQL to base this statement
* on.
*/
public RepeatableStatement(String sql)
{
this.sql = sql;
this.mutex = new Semaphore(1);
}
/*
* Close the statement.
*/
public void close()
{
try
{
try
{
this.mutex.acquire();
} catch (InterruptedException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
for (PreparedStatement statement : this.statementCache)
{
try
{
statement.close();
} catch (SQLException e)
{
logger.log(Level.SEVERE,
"Failed to close PreparedStatement", e);
}
}
} finally
Search WWH ::




Custom Search