use of com.alibaba.otter.node.etl.load.loader.weight.WeightController in project otter by alibaba.
the class WeightWorkerTest method test_simple.
@Test
public void test_simple() {
int thread = 10;
int count = 10;
WeightController controller = new WeightController(thread);
CountDownLatch latch = new CountDownLatch(thread);
WeightWorkerTest[] workers = new WeightWorkerTest[thread];
for (int i = 0; i < thread; i++) {
int[] weights = new int[count];
for (int j = 0; j < count; j++) {
weights[j] = RandomUtils.nextInt(count);
}
workers[i] = new WeightWorkerTest(i, weights, controller, latch);
}
for (int i = 0; i < thread; i++) {
workers[i].start();
}
try {
latch.await();
} catch (InterruptedException e) {
want.fail();
}
}
Aggregations