git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1038566 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2010-11-24 11:48:27 +00:00
parent 6eafe9327e
commit d6ad7c7cd0
1 changed files with 3 additions and 10 deletions

View File

@ -26,14 +26,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@ -106,7 +99,7 @@ public class PageFile {
int writeBatchSize = DEFAULT_WRITE_BATCH_SIZE; int writeBatchSize = DEFAULT_WRITE_BATCH_SIZE;
// We keep a cache of pages recently used? // We keep a cache of pages recently used?
private LRUCache<Long, Page> pageCache; private Map<Long, Page> pageCache;
// The cache of recently used pages. // The cache of recently used pages.
private boolean enablePageCaching=true; private boolean enablePageCaching=true;
// How many pages will we keep in the cache? // How many pages will we keep in the cache?
@ -301,7 +294,7 @@ public class PageFile {
if (loaded.compareAndSet(false, true)) { if (loaded.compareAndSet(false, true)) {
if( enablePageCaching ) { if( enablePageCaching ) {
pageCache = new LRUCache<Long, Page>(pageCacheSize, pageCacheSize, 0.75f, true); pageCache = Collections.synchronizedMap(new LRUCache<Long, Page>(pageCacheSize, pageCacheSize, 0.75f, true));
} }
File file = getMainPageFile(); File file = getMainPageFile();