org.apache.hadoop.service.CompositeService Java Examples
The following examples show how to use
org.apache.hadoop.service.CompositeService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestSimpleScheduler.java From tajo with Apache License 2.0 | 5 votes |
@Before public void setup() { conf = new TajoConf(); nodeResource = NodeResource.createResource(2000, 3); service = new CompositeService(TestSimpleScheduler.class.getSimpleName()) { @Override protected void serviceInit(Configuration conf) throws Exception { dispatcher = new AsyncDispatcher(); addService(dispatcher); rmContext = new TajoRMContext(dispatcher); rmContext.getDispatcher().register(NodeEventType.class, new TajoResourceManager.WorkerEventDispatcher(rmContext)); barrier = new Semaphore(0); scheduler = new MySimpleScheduler(rmContext, barrier); addService(scheduler); rmContext.getDispatcher().register(SchedulerEventType.class, scheduler); for (int i = 0; i < workerNum; i++) { WorkerConnectionInfo conn = new WorkerConnectionInfo("host" + i, 28091 + i, 28092, 21000, 28093, 28080); rmContext.getNodes().putIfAbsent(conn.getId(), new NodeStatus(rmContext, NodeResources.clone(nodeResource), conn)); rmContext.getDispatcher().getEventHandler().handle(new NodeEvent(conn.getId(), NodeEventType.STARTED)); } super.serviceInit(conf); } }; service.init(conf); service.start(); assertEquals(workerNum, rmContext.getNodes().size()); totalResource = NodeResources.createResource(0); for(NodeStatus nodeStatus : rmContext.getNodes().values()) { NodeResources.addTo(totalResource, nodeStatus.getTotalResourceCapability()); } }
Example #2
Source File: SpliceTestYarnPlatform.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
public CompositeService getYarnCluster() { return yarnCluster; }