@Test public void get() throws Exception { final long blockId = IdUtils.getRandomNonNegativeLong(); final AlluxioURI fileUri = new AlluxioURI("/mnt/file"); final String localFilePath = new AlluxioURI(mLocalUfsPath).join("file").getPath(); mLocalUfs.create(localFilePath); final List<String> ufsLocations = mLocalUfs.getFileLocations(localFilePath); for (String location : ufsLocations) { System.out.println(location); } Assert.assertNull(mUfsBlockLocationCache.get(blockId)); List<String> locations = mUfsBlockLocationCache.get(blockId, fileUri, 0); Assert.assertArrayEquals(ufsLocations.toArray(), locations.toArray()); locations = mUfsBlockLocationCache.get(blockId); Assert.assertArrayEquals(ufsLocations.toArray(), locations.toArray()); mUfsBlockLocationCache.invalidate(blockId); Assert.assertNull(mUfsBlockLocationCache.get(blockId)); }
@Override public List<String> get(long blockId) { return mCache.getIfPresent(blockId); }
LazyUfsBlockLocationCache implements UfsBlockLocationCache { @Override public List<String> get(long blockId) { return mCache.getIfPresent(blockId); } }
LazyUfsBlockLocationCache implements UfsBlockLocationCache { @Override public List<String> get(long blockId) { return mCache.getIfPresent(blockId); } LazyUfsBlockLocationCache(MountTable mountTable); }
LazyUfsBlockLocationCache implements UfsBlockLocationCache { @Override public List<String> get(long blockId) { return mCache.getIfPresent(blockId); } LazyUfsBlockLocationCache(MountTable mountTable); @Override void invalidate(long blockId); @Override List<String> get(long blockId); @Override @Nullable List<String> get(long blockId, AlluxioURI fileUri, long offset); }
LazyUfsBlockLocationCache implements UfsBlockLocationCache { @Override public List<String> get(long blockId) { return mCache.getIfPresent(blockId); } LazyUfsBlockLocationCache(MountTable mountTable); @Override void invalidate(long blockId); @Override List<String> get(long blockId); @Override @Nullable List<String> get(long blockId, AlluxioURI fileUri, long offset);  }