/** * Factory for {@link Allocator}. * * @param view {@link BlockMetadataManagerView} to pass to {@link Allocator} * @return the generated {@link Allocator}, it will be a {@link MaxFreeAllocator} by default */ public static Allocator create(BlockMetadataManagerView view) { BlockMetadataManagerView managerView = Preconditions.checkNotNull(view); try { return CommonUtils.createNewClassInstance( Configuration.<Allocator>getClass(PropertyKey.WORKER_ALLOCATOR_CLASS), new Class[] {BlockMetadataManagerView.class}, new Object[] {managerView}); } catch (Exception e) { throw Throwables.propagate(e); } }