Code example for MapMaker

Methods: makeMap

0
public class InMemoryStorage extends DocumentBinaryStorage { 
  private static final Logger logger = Logger.getLogger(Execute.whoAmI());
  private static final String MAIN_FILE_NAME = "InMemoryStorage";
 
  private final File backupDir;
  private ConcurrentMap<String, byte[]> compressedMap = new MapMaker().makeMap();
 
  @SuppressWarnings("unchecked") 
  public InMemoryStorage(File backupDir, boolean load) throws IOException {
    Preconditions.checkNotNull(backupDir);
    checkDirArgument(backupDir);
    this.backupDir = backupDir;
    File f = new File(this.backupDir, MAIN_FILE_NAME);
    if (load && f.exists()) {
      ObjectInputStream is = null;
      try { 
        is = new ObjectInputStream(new BufferedInputStream(new FileInputStream(f)));
        try { 
          compressedMap = (ConcurrentMap<String, byte[]>) is.readObject();
        } catch (ClassNotFoundException e) {