public final void cacheStatement ( Statement statement , StatementCacheKey key ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( this , tc , "cacheStatement" , AdapterUtil . toString ( statement ) , key ) ; // Add the statement to the cache. If there is no room in the cache, a statement from // the least recently used bucket will be cast out of the cache. Any statement cast // out of the cache must be closed. CacheMap cache = getStatementCache ( ) ; Object discardedStatement = cache == null ? statement : statementCache . add ( key , statement ) ; if ( discardedStatement != null ) destroyStatement ( discardedStatement ) ; }
Returns the statement into the cache . The statement is closed if an error occurs attempting to cache it . This method will only called if statement caching was enabled at some point although it might not be enabled anymore .