public class ClhmStatementCache extends Object implements StatementCache
ConcurrentLinkedHashMap.| Constructor and Description |
|---|
ClhmStatementCache(int maxSize) |
| Modifier and Type | Method and Description |
|---|---|
protected ConcurrentMap<StatementMethod,StatementHolder> |
buildStatementCache(int maxSize) |
void |
close()
Closes this ClhmStatementCache and removes all entries from it.
|
boolean |
isClosed()
Returns
true if this StatementCache is closed; false otherwise. |
boolean |
remove(StatementHolder statement)
Removes an entry from the cache (if such) for the given
statement. |
int |
removeAll(Connection rawConnection)
Removes all entries from the cache (if any) for the given
rawConnection. |
boolean |
restore(StatementHolder statement,
boolean clearWarnings)
Restores (i.e.
|
StatementHolder |
take(StatementMethod statementMethod)
Returns a possibly cached StatementHolder object for the given connection statement method.
|
protected ConcurrentMap<StatementMethod,StatementHolder> buildStatementCache(int maxSize)
public StatementHolder take(StatementMethod statementMethod) throws SQLException
StatementCachetake in interface StatementCachestatementMethod - the statement methodSQLException - if the invoked underlying "prepare..." method throws an exceptionpublic boolean restore(StatementHolder statement, boolean clearWarnings)
StatementCacheStatementHolder back in the cache.restore in interface StatementCachestatement - the given StatementHolderclearWarnings - if true will execute Statement.clearWarnings() on the underlying
raw PreparedStatementstatement in the cache, false otherwisepublic boolean remove(StatementHolder statement)
StatementCachestatement. Does not close
the removed statement.remove in interface StatementCachestatement - the StatementHolder to be removedpublic int removeAll(Connection rawConnection)
StatementCacherawConnection. Closes
all removed statements.removeAll in interface StatementCacherawConnection - the connection for which the entries to be removedpublic void close()
close in interface StatementCachepublic boolean isClosed()
StatementCachetrue if this StatementCache is closed; false otherwise.isClosed in interface StatementCacheCopyright © 2013-2019 vibur.org. All Rights Reserved.