Author: sannegrinovero
Date: 2008-06-17 09:21:29 -0400 (Tue, 17 Jun 2008)
New Revision: 14773
Modified:
search/trunk/src/java/org/hibernate/search/reader/SharingBufferReaderProvider.java
Log:
HSEARCH-212 : new ReaderProvider final cleanups
Modified:
search/trunk/src/java/org/hibernate/search/reader/SharingBufferReaderProvider.java
===================================================================
---
search/trunk/src/java/org/hibernate/search/reader/SharingBufferReaderProvider.java 2008-06-17
13:03:13 UTC (rev 14772)
+++
search/trunk/src/java/org/hibernate/search/reader/SharingBufferReaderProvider.java 2008-06-17
13:21:29 UTC (rev 14773)
@@ -35,7 +35,7 @@
* contains all Readers (most current per DP and all unclosed old)
*/
//TODO ConcurrentHashMap's constructor could benefit from some hints as arguments.
- protected final Map<IndexReader,ReaderUsagePair> allReaders = new
ConcurrentHashMap<IndexReader,ReaderUsagePair>( 100 );
+ protected final Map<IndexReader,ReaderUsagePair> allReaders = new
ConcurrentHashMap<IndexReader,ReaderUsagePair>();
/**
* contains last updated Reader; protected by lockOnOpenLatest (in the values)
@@ -53,7 +53,7 @@
else {
throw new AssertionFailure( "Everything should be wrapped in a MultiReader"
);
}
- log.trace( "Closing MultiReader: {}", multiReader );
+ log.debug( "Closing MultiReader: {}", multiReader );
for ( IndexReader reader : readers ) {
ReaderUsagePair container = allReaders.get( reader );
container.close();//virtual
@@ -76,13 +76,14 @@
}
public IndexReader openReader(DirectoryProvider... directoryProviders) {
- boolean trace = log.isTraceEnabled();
int length = directoryProviders.length;
IndexReader[] readers = new IndexReader[length];
- if ( trace ) log.trace( "Opening IndexReader for directoryProviders: {}",
length );
- for (int index = 0; index < length; index++) {
+ log.debug( "Opening IndexReader for directoryProviders: {}", length );
+ for ( int index = 0; index < length; index++ ) {
DirectoryProvider directoryProvider = directoryProviders[index];
- if ( trace ) log.trace( "Opening IndexReader from {}",
directoryProvider.getDirectory() );
+ if ( log.isTraceEnabled() ) {
+ log.trace( "Opening IndexReader from {}", directoryProvider.getDirectory()
);
+ }
PerDirectoryLatestReader directoryLatestReader = currentReaders.get( directoryProvider
);
readers[index] = directoryLatestReader.refreshAndGet();
}