public static DataServer createDataServer(final InetSocketAddress dataAddress, final BlockDataManager blockDataManager, TachyonConf conf) { try { return CommonUtils.createNewClassInstance( conf.<DataServer>getClass(Constants.WORKER_DATA_SERVER), new Class[] { InetSocketAddress.class, BlockDataManager.class, TachyonConf.class }, new Object[] { dataAddress, blockDataManager, conf }); } catch (Exception e) { throw Throwables.propagate(e); } } }
/** * @param conf TachyonConf to get the type of {@link JournalFormatter} * @return the created formatter */ public static JournalFormatter createJournalFormatter(TachyonConf conf) { try { return CommonUtils.createNewClassInstance( conf.<JournalFormatter>getClass(Constants.MASTER_JOURNAL_FORMATTER_CLASS), null, null); } catch (Exception e) { throw Throwables.propagate(e); } } }
/** * @param conf Tachyon configuration * @return a new instance of <code>RemoteBlockReader</code> */ public static RemoteBlockReader createRemoteBlockReader(TachyonConf conf) { try { return CommonUtils.createNewClassInstance( conf.<RemoteBlockReader>getClass(Constants.USER_BLOCK_REMOTE_READER), null, null); } catch (Exception e) { throw Throwables.propagate(e); } } }
/** * @param conf TachyonConf to determine the scheduler type * @return the generated scheduler */ public static CheckpointScheduler createScheduler(TachyonConf conf, LineageStoreView store) { try { return CommonUtils.createNewClassInstance( conf.<CheckpointScheduler>getClass(Constants.MASTER_LINEAGE_CHECKPOINT_CLASS), new Class[] {LineageStoreView.class}, new Object[] {store}); } catch (Exception e) { throw Throwables.propagate(e); } } }
/** * Creates a new <code>RemoteBlockWriter</code>. * * @param conf Tachyon configuration * @return a new instance of <code>RemoteBlockWriter</code> */ public static RemoteBlockWriter createRemoteBlockWriter(TachyonConf conf) { try { return CommonUtils.createNewClassInstance( conf.<RemoteBlockWriter>getClass(Constants.USER_BLOCK_REMOTE_WRITER), null, null); } catch (Exception e) { throw Throwables.propagate(e); } } }
/** * @param conf TachyonConf to determine the evictor type * @param view BlockMetadataManagerView to pass to Evictor * @param allocator an allocation policy * @return the generated Evictor */ public static Evictor createEvictor(TachyonConf conf, BlockMetadataManagerView view, Allocator allocator) { try { return CommonUtils.createNewClassInstance( conf.<Evictor>getClass(Constants.WORKER_EVICTOR_CLASS), new Class[]{BlockMetadataManagerView.class, Allocator.class}, new Object[]{view, allocator}); } catch (Exception e) { throw Throwables.propagate(e); } } }
/** * Create a new {@link Allocator} instance, will return {@link MaxFreeAllocator} by default * * @param conf Tachyon conf defined Allocator type * @param view BlockMetadataManagerView to pass to Allocator * @return the generated Allocator, it will be a {@link MaxFreeAllocator} by default */ public static Allocator createAllocator(TachyonConf conf, BlockMetadataManagerView view) { BlockMetadataManagerView managerView = Preconditions.checkNotNull(view); try { return CommonUtils.createNewClassInstance( conf.<Allocator>getClass(Constants.WORKER_ALLOCATOR_CLASS), new Class[] {BlockMetadataManagerView.class}, new Object[] {managerView}); } catch (Exception e) { throw Throwables.propagate(e); } } }