/** * Constructor. * * @throws FileNotFoundException */ public ThriftReader(File file) throws FileNotFoundException { this.file = file; open(); }
public EngineManager getManager(String tablespace, long version, int partition) throws DNodeException, IOException { // Look for the EHCache database pool cache String dbKey = tablespace + "_" + version + "_" + partition; Element dbPoolInCache = null; synchronized (dbCache) { dbPoolInCache = dbCache.get(dbKey); if (dbPoolInCache == null) { File dbFolder = getLocalStorageFolder(tablespace, partition, version); if (!dbFolder.exists()) { log.warn("Asked for " + dbFolder + " but it doesn't exist!"); throw new DNodeException(EXCEPTION_ORDINARY, "Requested tablespace (" + tablespace + ") + version (" + version + ") is not available."); } File metadata = getLocalMetadataFile(tablespace, partition, version); ThriftReader reader = new ThriftReader(metadata); PartitionMetadata partitionMetadata = (PartitionMetadata) reader.read(new PartitionMetadata()); reader.close(); dbPoolInCache = loadManagerInEHCache(tablespace, version, partition, dbFolder, partitionMetadata); } } return ((EngineManager) dbPoolInCache.getObjectValue()); }
ThriftReader reader = new ThriftReader(metadataFile); PartitionMetadata metadata = (PartitionMetadata) reader.read(new PartitionMetadata()); reader.close(); if (servingInfo.get(tablespaceName) == null) { servingInfo.put(tablespaceName, new HashMap<Long, Map<Integer, PartitionMetadata>>());